Easier ways of getting an attribute from an object?

Author Message

Paul Forsyth

Wednesday 14 July 2004 4:25:41 am

I may have missed something but it would be very nice to have easier ways of getting attribute objects from objects without needing to search for yourself.

At the moment i either iterate through the array the function contentObjectAttributes returns from eZContentObject, or if i can safely use the index of the array i access directly.

eZContentObjectAttribute has the function fetchByIdentifier but that doesnt seem to get a specific identifier from a single attribute, which would be nice.

A function in eZContentObject to fetchByAttributeIdentifier would be nice.

paul

Paul Forsyth

Thursday 26 August 2004 7:03:46 am

Bumping this one up.

paul

Björn Dieding@xrow.de

Thursday 26 August 2004 7:13:13 am

# co has one contentobject attribute called name(identifier)
$co = eZContentobejct::fetch($id);

$datamap =& $co->attribute('data_map');

$value = $datamap['name']->content();
or
$value = $datamap['name']->attribute('data_text');

$datamap['name']->setAttribute('data_text', ' new value');

$datamap['name']->store();

did this help?

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Paul Forsyth

Thursday 26 August 2004 8:01:02 am

Excellent, thanks!

paul

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 00:59:47
Script start
Timing: Jan 19 2025 00:59:47
Module start 'layout'
Timing: Jan 19 2025 00:59:47
Module start 'content'
Timing: Jan 19 2025 00:59:48
Module end 'content'
Timing: Jan 19 2025 00:59:48
Script end

Main resources:

Total runtime1.2200 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.0051 590.4063152.6406
Module start 'layout' 0.00510.0035 743.046939.4922
Module start 'content' 0.00861.2098 782.5391540.6875
Module end 'content' 1.21840.0015 1,323.226612.1250
Script end 1.2199  1,335.3516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2589160.0002
Check MTime0.00140.1143160.0001
Mysql Total
Database connection0.00110.092110.0011
Mysqli_queries1.163395.3549600.0194
Looping result0.00080.0617580.0000
Template Total1.178196.620.5891
Template load0.00200.159920.0010
Template processing1.176296.408920.5881
Template load and register function0.00020.013010.0002
states
state_id_array0.00220.177310.0022
state_identifier_array0.00200.164620.0010
Override
Cache load0.00160.1321250.0001
Sytem overhead
Fetch class attribute can translate value0.00070.059320.0004
Fetch class attribute name0.00090.076650.0002
XML
Image XML parsing0.00060.052620.0003
class_abstraction
Instantiating content class attribute0.00000.000950.0000
General
dbfile0.00180.1485160.0001
String conversion0.00000.000740.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
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs