Forums / Developer / Error: eZContentObject::fetch(): Object not found

Error: eZContentObject::fetch(): Object not found

Author Message

Dominik Pich

Thursday 18 December 2003 12:51:59 am

Why does this NOT work
{let menuitem=fetch('content', object, hash(object_id, 46))}
while this does:
{let children_count=fetch('content',list_count,hash(parent_node_id,46))

Olav Lillebø

Thursday 18 December 2003 1:54:44 am

Suggestion. If it is node_id 46 you are interested in, it's object_id is probably not 46. You can try {$node|attribute(show)}

 

Gunnstein Lye

Thursday 18 December 2003 2:38:56 am

Yup, nodes and objects are not the same. The object is the collection of attributes, and the node is a placement in the tree. They usually have different IDs. You can see the object id for instance in the edit link.

Dominik Pich

Thursday 18 December 2003 2:47:45 am

First, thank you both for your fast replies.
Ill check your solutions now.

One more question though... can object_ids and node_ids equal? For some IDs it even works.

Gunnstein Lye

Thursday 18 December 2003 2:54:57 am

Yes, they can be equal, but that's just coincidence.

Dominik Pich

Thursday 18 December 2003 3:16:11 am

//node_id used
{let menuitem=fetch('content', object, hash(object_id, 45))}
{node_view_gui view=menu content_node=$menuitem element_id="carlton" element_name="menu"}
{/let}

//object_id used
{let menuitem=fetch('content', object, hash(object_id, 42))}
{node_view_gui view=menu content_node=$menuitem element_id="carlton" element_name="menu"}
{/let}

// FOR THE ABOVE NODE_ID WORKS

in menu.tpl as called by node_view gui
$node.id = ID from above
{let children_count=fetch('content',list_count,hash(parent_node_id,$node.id))}
if node_id count > 0 else count == 0

Gunnstein Lye

Thursday 18 December 2003 4:04:18 am

When you use fetch('content', object, hash(object_id,xx)) then xx MUST be an object id.
When you use node_view_gui, you MUST supply a node. $menuitem is a content object in this case. This should work:
{node_view_gui view=menu content_node=$menuitem.main_node ...

fetch('content',list_count,hash(parent_node_id,$node.id))
$node.id will not work. Use $node_id or $node.node_id, depending on your template code.

Dominik Pich

Thursday 18 December 2003 4:27:51 am

The difference between a node and an object wasnt clear to me. I now use the func. 'node' to which I pass node_id and later on, $node.node_id

It isnt clear to me at all why some did work before but now all do.

Thank you

Balazs Halasy

Thursday 18 December 2003 4:35:12 am

Regarding the difference between objects and nodes, please read the docs:

http://ez.no/developer/ez_publish_3/documentation/ez_publish_basics/content_management_in_ez_publish/objects_nodes_and_the_content_node_tree

Balazs