Fetching main node id in script

Author Message

Eirik Alfstad Johansen

Thursday 22 January 2004 7:57:05 am

Hi,

I need to fetch the main node id for an object in a module, but when I use the following:

$object = eZContentObject::fetch( $object_id );

...the MainNodeID attribute of the object returned is emtpy.

Why does this happen, and are there any other ways to fetch the MainNodeID for an object?

Thanks in advance !

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Roy Viggo Pedersen

Monday 26 January 2004 3:51:28 am

Hi,

It should be as simple as:

$mainNodeID = $object->attribute( 'main_node_id' );

But I guess you have tried that, and $mainNodeID is still empty? What about $object? Are you sure it is defined?

Roy

Eirik Alfstad Johansen

Thursday 29 January 2004 1:07:36 am

Hi Roy,

Actually, I hadn't, and it worked. For debugging purposes, I was using the PHP function get_object_vars() which showed the MainNodeID as emtpy, but accessing it using the attribute method worked like a charm.

Thanks !

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

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 31 2025 04:27:28
Script start
Timing: Jan 31 2025 04:27:28
Module start 'layout'
Timing: Jan 31 2025 04:27:28
Module start 'content'
Timing: Jan 31 2025 04:27:28
Module end 'content'
Timing: Jan 31 2025 04:27:28
Script end

Main resources:

Total runtime0.0150 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 588.1328151.2109
Module start 'layout' 0.00590.0028 739.343836.6484
Module start 'content' 0.00870.0048 775.992290.0469
Module end 'content' 0.01350.0015 866.039133.9922
Script end 0.0150  900.0313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002416.1462140.0002
Check MTime0.00106.9501140.0001
Mysql Total
Database connection0.00138.694810.0013
Mysqli_queries0.003120.731530.0010
Looping result0.00000.087210.0000
Template Total0.00117.410.0011
Template load0.00085.441810.0008
Template processing0.00031.916010.0003
Override
Cache load0.00063.911210.0006
General
dbfile0.00031.760580.0000
String conversion0.00000.047640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs