Forums / Developer / php: having object_id I need node_id
Jorge estévez
Wednesday 17 March 2010 6:27:26 am
Using PHP:
Having the object_id of a node, How can I get the node_id?
I need to do a fetch of the node.
help please!
thanks
Diseño Web Cuba Web Design Cuba www.elfosdesign.com
Nicolas Pastorino
Wednesday 17 March 2010 7:20:37 am
Hi Jorge,
Two solutions from here. The first one should be better in terms of performances :
// Better performances : // Warning: the $node variable is an array, not an object. $node = eZContentObjectTreeNode::fetchByContentObjectID( $objectId, false ); $nodeId = $node['node_id']
The second one gives you back the fully feature node object :
// Full object retrieval : // The $node variable is an instance of the eZContentObjectTreeNode class $node = eZContentObjectTreeNode::fetchByContentObjectID( $objectId ); $nodeId = $node->attribute( 'node_id' );
Hope it helped :)
-- Nicolas Pastorino Director Community - eZ Member of the Community Project Board eZ Publish Community on twitter: http://twitter.com/ezcommunity t : http://twitter.com/jeanvoye G+ : http://plus.tl/jeanvoye
Jean-Luc Nguyen
Wednesday 17 March 2010 7:32:08 am
Hello,
You may use :
$nodeRows = eZContentObjectTreeNode::fetchByContentObjectID( $objectID, false );
which will returns all locations for this $objectID.
http://www.acidre.com
Wednesday 17 March 2010 7:33:32 am
This is funny, my comment on this post is taking my local computer time...
Wednesday 17 March 2010 7:37:29 am
I guess I was wrong.