Getting content class object attributes

Author Message

Børge Warvik

Thursday 24 August 2006 4:35:39 am

Hi

I'm creating a feedback module. Mostly it's working fine. The feedback object is stored as a child of the content object, and the user is recieving an email that confirms that the feedback has been stored in our system.

The feedback module should also inform the author of the content object that s/he has recieved some feedback and should login to read it.

For the system to to send this email to the author(s) it need to get the authors from the content object. I've created the content class author. Every author is stored in an authorfolder. Every other contentobject has an attribute of type object relations, here are one or multiple authors referenced from the authorfolder.

Now using this code:

$node = eZContentObjectTreeNode::fetch( $NodeID );

I'm not able to get hold of these author objects.

Any idea how I can accomplish this?

Claudia Kosny

Thursday 24 August 2006 2:47:01 pm

Hi Børge

Try to fetch the contentobject of this node. The contentobject again has an attribute related_contentobject_array which should give you access to the information you want.

Greetings from Luxembourg

Claudia

Børge Warvik

Friday 25 August 2006 12:23:48 am

Hi

Thanks for the answer, but I can't seem to get it to work.

This just gives me an empty array:

$node = eZContentObjectTreeNode::fetch( $nodeID );
$coNode = eZContentObject::fetch( $node->ContentObjectID );

echo "<pre>";
print_r( $coNode->relatedContentObjectArray() );
echo "</pre>";

Could you mayby post some example code of what you mean?

Kristof Coomans

Friday 25 August 2006 1:45:23 am

Hello Børge

Try this:

$node = eZContentObjectTreeNode::fetch( $nodeID );
$object =& $node->attribute( 'object' );

echo "<pre>";
print_r( $object->relatedContentObjectList( false, false, $classAttributeID );
echo "</pre>";

where $classAttributeID is the id of the class attribute with related authors. You can also use a boolean false instead if you want all related objects (made on both object and object attribute level), and 0 (the default) for related objects made on object level.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

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