Fetch reverse related objects and sort_by attribute

Author Message

Ulrich L.

Monday 22 January 2007 2:58:05 pm

Hi,
as the documentation states: when using "fetch(content, reverse_related_objects...)" it is not possible to perform sort_by with the attribute parameter, as it is possible with "fetch(content, list, ...)"
This is really a pity! Does anybody have a good suggestion how to use "fetch(content, reverse_related_objects...)" AND to perform sorting by attribute in a different way?
I really need this...

Thanks,
Ulrich

eZ 3.8.5

Andreas Kaiser

Tuesday 23 January 2007 12:07:30 pm

I have some problems getting inside a template the nice url to a "related object" - and looking around I found these:

Perhaps these posts help you out:

http://ez.no/community/forum/general/object_relations

Perhaps this contribution helps:

http://ez.no/community/contribs/datatypes/enhanced_objectrelation

eZ Partner in Madrid (Spain)
Web: http://www.atela.net/

Ulrich L.

Wednesday 24 January 2007 6:35:31 am

Thanks.

I don't intend to join EOR since eZpublish manages to cover pretty much of that functionality out of the box today.

The forum thread is interesting. In the middle of it somebody explains that for sorting he creates a sort function, written in PHP and located in index.php.
Is this the only way to go for me, too?

Xavier Dutoit

Wednesday 24 January 2007 11:54:14 pm

Hi,

I suggest to create a custom sort template function (that could be used to sort any node/object table).

Eg :

{$unsorted_objects = fetch(content, reverse_related_objects...)
$sorted = {$unsorted|sort('your_attribute',true())}

X+

http://www.sydesy.com

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 16:25:27
Script start
Timing: Jan 18 2025 16:25:28
Module start 'layout'
Timing: Jan 18 2025 16:25:28
Module start 'content'
Timing: Jan 18 2025 16:25:28
Module end 'content'
Timing: Jan 18 2025 16:25:28
Script end

Main resources:

Total runtime0.0157 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.0055 588.1563152.6563
Module start 'layout' 0.00550.0029 740.812539.4922
Module start 'content' 0.00840.0049 780.304789.4766
Module end 'content' 0.01330.0023 869.781334.3047
Script end 0.0157  904.0859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002515.6987140.0002
Check MTime0.00116.8677140.0001
Mysql Total
Database connection0.00084.781410.0008
Mysqli_queries0.002213.750630.0007
Looping result0.00000.171610.0000
Template Total0.002012.710.0020
Template load0.00085.355410.0008
Template processing0.00117.285310.0011
Override
Cache load0.00063.794510.0006
General
dbfile0.00021.412180.0000
String conversion0.00000.050140.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