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.

eZ debug

Timing: Jan 19 2025 04:43:55
Script start
Timing: Jan 19 2025 04:43:55
Module start 'layout'
Timing: Jan 19 2025 04:43:55
Module start 'content'
Timing: Jan 19 2025 04:43:56
Module end 'content'
Timing: Jan 19 2025 04:43:56
Script end

Main resources:

Total runtime0.6178 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 589.2734152.6406
Module start 'layout' 0.00680.0025 741.914139.4766
Module start 'content' 0.00930.6070 781.3906590.2422
Module end 'content' 0.61630.0014 1,371.632812.1406
Script end 0.6178  1,383.7734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.5497160.0002
Check MTime0.00140.2197160.0001
Mysql Total
Database connection0.00110.172810.0011
Mysqli_queries0.555289.8706620.0090
Looping result0.00090.1451600.0000
Template Total0.586694.920.2933
Template load0.00200.324720.0010
Template processing0.584594.615220.2923
Template load and register function0.00020.025310.0002
states
state_id_array0.00100.167610.0010
state_identifier_array0.00090.152720.0005
Override
Cache load0.00170.2744300.0001
Sytem overhead
Fetch class attribute can translate value0.00070.117930.0002
Fetch class attribute name0.00160.265660.0003
XML
Image XML parsing0.00120.186930.0004
class_abstraction
Instantiating content class attribute0.00000.002170.0000
General
dbfile0.00180.2907220.0001
String conversion0.00000.001040.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.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
3content/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: 19
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs