Forums / Developer / How to get all contentobject attributes of a certain version

How to get all contentobject attributes of a certain version

Author Message

Ralph Ekekihl

Monday 23 May 2005 9:48:42 am

Hi!

I need to fetch all the contentobject attributes under a certain Classattribute, now I am doing:

$contentAttributeList =& eZContentObjectAttribute::fetchListByClassID($ID)

but this returns ALL the versions of the contentobject attributes, I only want the published versions or the latests versions!

It this possible somehow?
really thankful for some help, cause Im a bit stuck here!

Regards,
Ralph Ekekihl

Contactivity B.V.
http://www.contactivity.com

Paul Forsyth

Monday 23 May 2005 11:02:23 am

If you know what the latest version is you can pass that value as the second parameter to your function.

Can you do a version check on your object? Eg $object->attribute('current_version');

paul

Ralph Ekekihl

Tuesday 24 May 2005 3:03:28 am

Hi Paul,

The problem is, I need to get a list of all ezcontentobejcts_attributes with a certain contentclass_attributeid, in this case, all ezobjectrelation attributes.
That is why I am using

eZContentObjectAttribute::fetchListByClassID()

I only need attributes by ClassID.

Now, all objectattributes also have their own version number, but that doesnt help me in this case..or does it?

If I fetch it on a object level, I can understand how I can use (current_version), but when I fetch it on a attribute level, how can I then easily get the current version of the parent object the attribute is under?

Thanks alot Paul!

//Ralph

Contactivity B.V.
http://www.contactivity.com

Paul Forsyth

Tuesday 24 May 2005 3:16:11 am

Yes, its a static call which does return all versions.

The version of an attribute is actually tied to the content object. If the content object goes up a version so does all of its attributes.

Looking at the fetchListByClassId its a shame that you cannot pass in something that sets the 'published field.

For example, adding:

$conditions['status'] => EZ_CONTENT_OBJECT_STATUS_PUBLISHED

would do the trick.

If you cant patch the kernel then you may need to iterate on the results and make sure you only keep the latest versions which are published. Not ideal but it would work.

Paul

eZ debug

Timing: Jan 31 2025 01:15:17
Script start
Timing: Jan 31 2025 01:15:17
Module start 'content'
Timing: Jan 31 2025 01:15:17
Module end 'content'
Timing: Jan 31 2025 01:15:17
Script end

Main resources:

Total runtime0.2674 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 588.1875370.2578
Module start 'content' 0.00770.0225 958.44531,005.7500
Module end 'content' 0.03020.2372 1,964.19533,894.3359
Script end 0.2673  5,858.5313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00491.8150200.0002
Check MTime0.00140.5401200.0001
Mysql Total
Database connection0.00070.250510.0007
Mysqli_queries0.134150.14221410.0010
Looping result0.00170.64061390.0000
Template Total0.236888.510.2368
Template load0.00080.311510.0008
Template processing0.235988.228710.2359
Override
Cache load0.00060.226710.0006
Sytem overhead
Fetch class attribute can translate value0.00190.720310.0019
XML
Image XML parsing0.00030.099510.0003
General
dbfile0.02639.8404200.0013
String conversion0.00000.002630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs