Forums / Extensions / eZ Flow / eZ Flow link block to pages with the node_id and not the object_id

eZ Flow link block to pages with the node_id and not the object_id

Author Message

gilles guirand

Wednesday 08 June 2011 9:11:53 am

Hi,

There is a free minding about the ezflow database model. The DB table is storing blocks by linking these blocks to a node_id (see below). Is there a reason for not using an object_id ?

Of course, this node_id usage cause some issues, you can imagine what's happend if you swap 2 nodes, of if you add some nodes locations

CREATE TABLE ezm_block (
    id CHAR(32) NOT NULL,
    zone_id CHAR(32) NOT NULL,
    name VARCHAR(255) NULL,
    node_id INTEGER UNSIGNED NOT NULL,
    overflow_id CHAR(32) NULL,
    last_update INTEGER UNSIGNED NULL DEFAULT 0,
    block_type VARCHAR(255) NULL,
    fetch_params LONGTEXT NULL,
    rotation_type INTEGER UNSIGNED NULL,
    rotation_interval INTEGER UNSIGNED NULL,
    is_removed INTEGER(2) UNSIGNED NULL DEFAULT 0,
    PRIMARY KEY(id)
) ENGINE=InnoDB;

CREATE INDEX ezm_block__is_removed ON ezm_block(is_removed);
CREATE INDEX ezm_block__node_id ON ezm_block(node_id);
CREATE TABLE ezm_pool (
    block_id CHAR(32) NOT NULL,
    object_id INTEGER UNSIGNED NOT NULL,
    node_id INTEGER UNSIGNED NOT NULL,
    priority INTEGER UNSIGNED NULL DEFAULT 0,
    ts_publication INTEGER NULL DEFAULT 0,
    ts_visible INTEGER UNSIGNED NULL DEFAULT 0,
    ts_hidden INTEGER UNSIGNED NULL DEFAULT 0,
    rotation_until INTEGER UNSIGNED NULL DEFAULT 0,
    moved_to CHAR(32) NULL,
    PRIMARY KEY(block_id, object_id)
) ENGINE=InnoDB;

CREATE INDEX ezm_pool__block_id__ts_publication__priority ON ezm_pool(block_id,ts_publication,priority);
CREATE INDEX ezm_pool__block_id__ts_visible ON ezm_pool(block_id,ts_visible);
CREATE INDEX ezm_pool__block_id__ts_hidden ON ezm_pool(block_id,ts_hidden);

--
Gilles Guirand
eZ Community Board Member
http://twitter.com/gandbox
http://www.gandbox.fr

Carlos Revillo

Wednesday 08 June 2011 9:38:52 am

this is a good one. if i'm not wrong, object_id was used in the firsts versions of ezflow, but that was changed to node_id. 

for me, it makes sense. when you browse for adding these elements to the blocks, you browse nodes and not objects. 

if you use the browse thing and probably select and object with several locations, how to tell ezflow that the result should link to that node and not to the main_node of the object? 

but i see your point. if you swap nodes probably you'll get some unwanted side effect, but ihmo that should be solved adding things to the swap operation. i mean 'if i swap this, look to ezflow blocks and change what is needed...'

Cheers. 

SEBBANE Alexandre

Wednesday 08 June 2011 9:52:33 am

I agree with Carlos. besides when you choose a source in an dynamic blocs : which node had to be chose ...

Ezflow helps us to create pages in order to show the content tree in an another way : the content tree is for me a tree of nodes before a tree of object...

Alex

Paris, France

gilles guirand

Thursday 09 June 2011 3:14:57 am

No, i speak about the ezm_block table, and not the ezm_pool table. This table is storing the link between a "page" and its block, and not the link between a block and its related items (ezm_pool job)

I update the POST with the DB declaration

--
Gilles Guirand
eZ Community Board Member
http://twitter.com/gandbox
http://www.gandbox.fr

Carlos Revillo

Thursday 09 June 2011 3:37:04 am

oh i see... yep, didn't realize this...  this is totally different question... btw, i wondering what will happen if you add a block to a object with several locations... will it create several entries in that ezm_pool table?

i will try and see... but if the answer is no... then why we need that node_id there?

SEBBANE Alexandre

Thursday 09 June 2011 10:07:20 am

yep same thing didn' see it at first time .

maybe something like cache you have the same in the all location so having the node_id avoid calculate cache many times ?

Alexandre

Paris, France