Forums / Setup & design / reverse_related_objects and sort order
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.