Forums / General / fetch on object relations

fetch on object relations

Author Message

gareth eke

Tuesday 25 November 2008 3:38:35 am

hi all, apologies in advance for asking such a basic question, but i'm having trouble with this fetch....

{def $score_count = fetch( 'content', 'tree_count', hash( 'parent_node_id', 2,

'class_filter_type', 'include', 'class_filter_array', array( '47' ),

'attribute_filter', array( array( 'score/player_name', '=', 'John Doe' ) )

) )}

where the 'player_name' attribute is an Object relation

i can't seem to return any results, have i missed something regarding object relations?

thanks

Arnaud Lafon

Tuesday 25 November 2008 4:56:17 am

Hi,

First, as far as I know, attribute_filter will only work with the Object Relation datatype but It won't work with the Object Relation<b>s</b> one. Are you using the correct datatype ?

Then, If I read the example 12 on this page http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/list, you should use the object ID instead of the related object name.

Hope this helps

Arnaud

Looking for information about SQLI ?
Looking for a new job in Paris ?
Please contact me at alafon [at] sqli [dot] com

gareth eke

Tuesday 25 November 2008 5:12:30 am

thanks for the reply Arnaud, yes, just to confirm i am using the Object relation, and not relations...my post was a bit ambiguous

gareth eke

Tuesday 25 November 2008 5:41:09 am

doh!

how typical is that, i couldn't solve this for weeks, so worked on other things instead. Then as soon as i post to the forum i accidentally stumble on how to fetch the results i want, using $node.object.id as below!

thanks to Arnaud and anyone else who took any time considering my question

Gareth

{def $score_count = fetch( 'content', 'tree_count', hash( 'parent_node_id', 2,

'class_filter_type', 'include', 'class_filter_array', array( '47' ),

'attribute_filter', array( array( 'score/player_name', '=', $node.object.id ) )

) )}

Arnaud Lafon

Tuesday 25 November 2008 7:23:21 am

You're welcome! :)

Looking for information about SQLI ?
Looking for a new job in Paris ?
Please contact me at alafon [at] sqli [dot] com

Simon Boyer

Wednesday 13 July 2011 8:05:11 am

Hi,

I added an extension to fetch objects with object relation(s) filter :

http://projects.ez.no/oworfilter

This extension provides an extended attribute filter to use with fetch functions.

--
Developer at Open Wide

eZ debug

Timing: Jan 29 2025 13:40:17
Script start
Timing: Jan 29 2025 13:40:17
Module start 'content'
Timing: Jan 29 2025 13:40:17
Module end 'content'
Timing: Jan 29 2025 13:40:17
Script end

Main resources:

Total runtime0.1206 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 587.9219180.8438
Module start 'content' 0.00510.0057 768.765697.9297
Module end 'content' 0.01090.1097 866.6953526.5234
Script end 0.1205  1,393.2188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00332.7748200.0002
Check MTime0.00131.1017200.0001
Mysql Total
Database connection0.00060.488510.0006
Mysqli_queries0.081767.78281410.0006
Looping result0.00090.73521390.0000
Template Total0.109490.710.1094
Template load0.00080.672510.0008
Template processing0.108690.013510.1086
Override
Cache load0.00060.476610.0006
Sytem overhead
Fetch class attribute can translate value0.00100.792510.0010
XML
Image XML parsing0.00030.222210.0003
General
dbfile0.00625.1621200.0003
String conversion0.00000.003230.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