Forums / Setup & design / reverse_related_objects and sort order

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.

eZ debug

Timing: Jan 18 2025 18:27:52
Script start
Timing: Jan 18 2025 18:27:52
Module start 'content'
Timing: Jan 18 2025 18:27:52
Module end 'content'
Timing: Jan 18 2025 18:27:52
Script end

Main resources:

Total runtime0.0139 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 588.9453180.8281
Module start 'content' 0.00610.0039 769.773494.0234
Module end 'content' 0.01000.0039 863.796970.7031
Script end 0.0138  934.5000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002215.4862120.0002
Check MTime0.00107.1821120.0001
Mysql Total
Database connection0.00075.325610.0007
Mysqli_queries0.002820.431040.0007
Looping result0.00000.108120.0000
Template Total0.003626.010.0036
Template load0.00086.044510.0008
Template processing0.002819.933410.0028
Override
Cache load0.00064.073210.0006
General
dbfile0.00032.0023100.0000
String conversion0.00000.036030.0000
Note: percentages do not add up to 100% because some accumulators overlap

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