reverse_related_objects and sort order

Author Message

Daniel Guerrier

Wednesday 21 September 2005 9:45:54 pm

I am using this code to get the instances of myclass that are pointing to an abject_id of 91.
It seems to ignore the sort parameter. When I print the objects it displays the items in the same order regardless of setting the sort published to true or false.

Is this the proper behavior? If so, how can I sort the results?

{def $objects=fetch( 'content', 'reverse_related_objects',
                     hash( 'object_id', 91,
                           'attribute_identifier', 'myclass/apointer',
						    'sort_by',  array( 'published', true() )
							) )}

Nathan Kelly

Wednesday 21 September 2005 11:38:32 pm

From my understanding I don't think you can use the "sort by" parameter with a "reverse_related_objects" fetch.

http://ez.no/doc/ez_publish/technical_manual/3_6/reference/modules/content/fetch_functions/reverse_related_objects

I know you can sort the results of a "list" fetch, but from the docs I not sure its possible with RRO?

I'm not sure but this: http://ez.no/community/contribs/datatypes/enhanced_objectrelation
may help you achieve sorting, I haven't looked into it that far though!

Cheers!

Pardon me while I burst into flames...

Sam Wong

Saturday 26 November 2005 11:24:06 am

Works fine for me.

{def $objects=fetch( 'content', 'reverse_related_objects', hash( object_id, $node.contentobject_id, attribute_identifier, 207, 'sort_by', array('published', false()) ) )}

Oh, BTW, this is for my related latest news... so naturally false() is for decending.

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 19:26:31
Script start
Timing: Jan 18 2025 19:26:31
Module start 'layout'
Timing: Jan 18 2025 19:26:31
Module start 'content'
Timing: Jan 18 2025 19:26:31
Module end 'content'
Timing: Jan 18 2025 19:26:31
Script end

Main resources:

Total runtime0.0403 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0134 589.1484152.6406
Module start 'layout' 0.01340.0075 741.789139.4766
Module start 'content' 0.02090.0160 781.265689.4609
Module end 'content' 0.03690.0033 870.726634.3047
Script end 0.0402  905.0313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.004210.4473140.0003
Check MTime0.00194.7256140.0001
Mysql Total
Database connection0.00184.572810.0018
Mysqli_queries0.011227.729530.0037
Looping result0.00000.059810.0000
Template Total0.00256.210.0025
Template load0.00184.418910.0018
Template processing0.00071.768810.0007
Override
Cache load0.00153.663210.0015
General
dbfile0.006215.510480.0008
String conversion0.00000.027240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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