Thursday 04 December 2008 9:58:36 am
Or (add the & like above if your on php 4):
$node = eZContentObjectTreeNode::findMainNode( $objectID, true );
$nodeId = $node->attribute('node_id');
Or if you don't need the node object, only node_id:
$nodeData = eZContentObjectTreeNode::fetchByContentObjectID( $objectID, false );
$nodeId = $nodeData['node_id'];
Tip Search for "n fetch" and "n find" in ezcontentobjecttreenode.php and ezcotententobject.php to see what kind of fetch functions you can use.
Tip2: To see what kind of attributes a class support(for classes that implements eZPersistantObject), see in the beginning of the class definition on the definition() function.
'fields' are attributes that are set when the object is constructed, while ''function_attributes" are attributes that are dynamically generated when you request them (they often need to fetch data from database before the return anything). One such example would be 'main_node_id' on eZContentObject. In other words the first two examples needs two sql calls while these two needs one (I'm not saying that less is always better, cause it's not when your database starts to get a allot of traffic and you give it a complex sql instead of several simple ones, but enough about that..).
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom
|