Forums / Developer / eZContentObject::fetch
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
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 ezcontentobjectname of its class "product"!? in ezcontentclass
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