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

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 18 2025 02:17:54
Script start
Timing: Jan 18 2025 02:17:54
Module start 'layout'
Timing: Jan 18 2025 02:17:54
Module start 'content'
Timing: Jan 18 2025 02:17:55
Module end 'content'
Timing: Jan 18 2025 02:17:55
Script end

Main resources:

Total runtime0.8514 sec
Peak memory usage4,096.0000 KB
Database Queries69

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0067 589.2891153.4531
Module start 'layout' 0.00680.0034 742.742239.3906
Module start 'content' 0.01020.8399 782.1328608.0469
Module end 'content' 0.85010.0013 1,390.179716.1641
Script end 0.8514  1,406.3438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3970160.0002
Check MTime0.00140.1635160.0001
Mysql Total
Database connection0.00060.069910.0006
Mysqli_queries0.784792.1676690.0114
Looping result0.00070.0784670.0000
Template Total0.817396.020.4087
Template load0.00210.251220.0011
Template processing0.815295.745220.4076
Template load and register function0.00010.016310.0001
states
state_id_array0.00080.098110.0008
state_identifier_array0.00080.098820.0004
Override
Cache load0.00180.2172400.0000
Sytem overhead
Fetch class attribute can translate value0.00050.059430.0002
Fetch class attribute name0.00120.141280.0002
XML
Image XML parsing0.00100.119630.0003
class_abstraction
Instantiating content class attribute0.00000.002490.0000
General
dbfile0.00150.1786230.0001
String conversion0.00000.001240.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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs