php: having object_id I need node_id

Author Message

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

Jean-Luc Nguyen

Wednesday 17 March 2010 7:33:32 am

This is funny, my comment on this post is taking my local computer time...

http://www.acidre.com

Jean-Luc Nguyen

Wednesday 17 March 2010 7:37:29 am

I guess I was wrong.

http://www.acidre.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 10:26:27
Script start
Timing: Jan 18 2025 10:26:27
Module start 'layout'
Timing: Jan 18 2025 10:26:27
Module start 'content'
Timing: Jan 18 2025 10:26:28
Module end 'content'
Timing: Jan 18 2025 10:26:28
Script end

Main resources:

Total runtime0.9732 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 587.9375152.6250
Module start 'layout' 0.00630.0029 740.562539.4453
Module start 'content' 0.00920.9625 780.0078600.3359
Module end 'content' 0.97170.0015 1,380.343812.1563
Script end 0.9732  1,392.5000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3278160.0002
Check MTime0.00120.1266160.0001
Mysql Total
Database connection0.00100.098210.0010
Mysqli_queries0.907493.2347650.0140
Looping result0.00110.1110630.0000
Template Total0.939496.520.4697
Template load0.00210.213120.0010
Template processing0.937396.308120.4686
Template load and register function0.00020.023310.0002
states
state_id_array0.00180.182510.0018
state_identifier_array0.00190.193520.0009
Override
Cache load0.00180.1869290.0001
Sytem overhead
Fetch class attribute can translate value0.00090.094330.0003
Fetch class attribute name0.00210.216570.0003
XML
Image XML parsing0.00110.112830.0004
class_abstraction
Instantiating content class attribute0.00000.001890.0000
General
dbfile0.00160.1693220.0001
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs