Get a content attribute object with only the attribute id

Author Message

Maxime Thomas

Thursday 26 March 2009 3:01:59 am

Hi,

A good one. I've got the content attribute id of an attribute and I would like to get the last attribute object. I searched in the API, try to use the fetch function but apparently you have to get the version id to to fetch the correct attribute but I don't have this one. You can get it but it's in the attribute object... :-(

So, how can I get the last version id which can help me to get the last attribute ?

It's working in other part of eZPublish because you already know the content on which your are. As it's an ajax feature, I don't have this piece of information.

$attribute = eZContentObjectAttribute::fetch($attribute_id, 1);

Thanks for any help.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

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 20 2025 03:08:06
Script start
Timing: Jan 20 2025 03:08:06
Module start 'layout'
Timing: Jan 20 2025 03:08:06
Module start 'content'
Timing: Jan 20 2025 03:08:07
Module end 'content'
Timing: Jan 20 2025 03:08:07
Script end

Main resources:

Total runtime1.4331 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 589.4141152.6563
Module start 'layout' 0.00560.0035 742.070339.5078
Module start 'content' 0.00911.4214 781.5781472.2578
Module end 'content' 1.43050.0026 1,253.83598.0938
Script end 1.4331  1,261.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.2569160.0002
Check MTime0.00160.1149160.0001
Mysql Total
Database connection0.00090.059710.0009
Mysqli_queries1.378496.1848460.0300
Looping result0.00050.0346440.0000
Template Total1.379996.320.6899
Template load0.00210.147420.0011
Template processing1.377896.137420.6889
Template load and register function0.00010.006810.0001
states
state_id_array0.00270.187310.0027
state_identifier_array0.00270.191620.0014
Override
Cache load0.00170.1184100.0002
Sytem overhead
Fetch class attribute can translate value0.00100.066910.0010
Fetch class attribute name0.00110.075820.0005
XML
Image XML parsing0.00050.037110.0005
class_abstraction
Instantiating content class attribute0.00000.000420.0000
General
dbfile0.01080.7566160.0007
String conversion0.00000.000640.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
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.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: 7
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs