eZContentObject::fetch

Author Message

Dominik Pich

Wednesday 21 April 2004 3:28:09 am

I do a eZContentObject::fetch( $object_id ) and get an object which seems ok but doesn't have class information. $object->attribute( "class_name" ) and $object->attribute( "content_class" ) both return "".

Without class info though, the node/view/line override is not used instead ez falls back to the default.

What to do?
Thank you,
Dominik

Paul Forsyth

Wednesday 21 April 2004 4:03:34 am

Thats a bit odd. Are you able to check the db and look at the objects values?

Did you create the object yourself?

paul

--
http://www.visionwt.com

Dominik Pich

Wednesday 21 April 2004 4:30:28 am

yes... I created them myself

in the db it seems correct !and! pages in the sitedesign folder not in a extension display the items just fine.

id of contentobject 139
id of its class 8 in ezcontentobject
name of its class "product"!? in ezcontentclass

Dominik Pich

Wednesday 21 April 2004 5:30:14 am

//assemble a list of contentObjects the user bought
$boughtObjects = array();
$boughtIds =& mysql_findproducts();
foreach( $boughtIds as $id )
{
	//eZDebug::writeDebug( 'user bought object with id ' . $id );	
	$object =& eZContentObject::fetch( $id ); 
	$boughtObjects[ count( $boughtObjects ) ] = $object;
}

foreach( $boughtObjects as $object )
{
	$contentClass = $object->attribute( "content_class" );
	eZDebug::writeDebug( 'user bought object with name ' . $object->attribute( "name" ) . ' of type ' . $object->attribute( "class_name" ) . ' which equals ' . $contentClass->attribute( "name" ) );
}

Outputs:
user bought object with name 01-00012-001: Am Zuckerhut of type which equals Product

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 19 2025 02:25:38
Script start
Timing: Jan 19 2025 02:25:38
Module start 'layout'
Timing: Jan 19 2025 02:25:38
Module start 'content'
Timing: Jan 19 2025 02:25:40
Module end 'content'
Timing: Jan 19 2025 02:25:40
Script end

Main resources:

Total runtime1.3669 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.1328152.6094
Module start 'layout' 0.00630.0029 741.742239.4141
Module start 'content' 0.00921.3564 781.1563480.9453
Module end 'content' 1.36560.0013 1,262.101612.1875
Script end 1.3669  1,274.2891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2576160.0002
Check MTime0.00140.1057160.0001
Mysql Total
Database connection0.00060.045010.0006
Mysqli_queries1.308095.6953600.0218
Looping result0.00060.0433580.0000
Template Total1.333797.620.6668
Template load0.00210.150120.0010
Template processing1.331697.418320.6658
Template load and register function0.00020.014110.0002
states
state_id_array0.00140.101310.0014
state_identifier_array0.00130.095620.0007
Override
Cache load0.00180.1285240.0001
Sytem overhead
Fetch class attribute can translate value0.00060.042320.0003
Fetch class attribute name0.00150.110340.0004
XML
Image XML parsing0.00030.019720.0001
class_abstraction
Instantiating content class attribute0.00000.000840.0000
General
dbfile0.00060.0444100.0001
String conversion0.00000.000840.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/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: 18
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs