Usage sort_by attribute on object_relation

Author Message

H-Works Agency

Wednesday 07 September 2005 7:54:40 am

Hi all

How can i use 'sort_by' mecanism during a content list fetch when i want to order the list according to an attribute that is an "object relation" list - list of objects of another class - The linked object class has a "name" attribute that i want to use to order ?

In human language : My product class has a "company" field linked to a list of companies. How can i order products according to its company name ?

Thanx for your help - Martin

EZP is Great

Gabriel Ambuehl

Wednesday 07 September 2005 11:07:03 am

Do some template code that fetches the data and sort it in place.

By default you can't sort relations for all I know.

Visit http://triligon.org

H-Works Agency

Saturday 10 September 2005 9:25:25 am

Ok thanx for your help - The problem is that it makes me double fetch the list...not very clean :\

Martin

EZP is Great

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 19 2025 07:16:23
Script start
Timing: Jan 19 2025 07:16:23
Module start 'layout'
Timing: Jan 19 2025 07:16:23
Module start 'content'
Timing: Jan 19 2025 07:16:24
Module end 'content'
Timing: Jan 19 2025 07:16:24
Script end

Main resources:

Total runtime0.6561 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 589.2891152.6406
Module start 'layout' 0.00480.0024 741.929739.4766
Module start 'content' 0.00720.6476 781.4063527.7813
Module end 'content' 0.65470.0013 1,309.187512.1250
Script end 0.6561  1,321.3125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4702160.0002
Check MTime0.00120.1838160.0001
Mysql Total
Database connection0.00080.122110.0008
Mysqli_queries0.613893.5489570.0108
Looping result0.00050.0734550.0000
Template Total0.626695.520.3133
Template load0.00200.308320.0010
Template processing0.624695.193520.3123
Template load and register function0.00010.019710.0001
states
state_id_array0.00100.149710.0010
state_identifier_array0.00110.169020.0006
Override
Cache load0.00160.2472150.0001
Sytem overhead
Fetch class attribute can translate value0.00090.136020.0004
Fetch class attribute name0.00090.139640.0002
XML
Image XML parsing0.00050.080220.0003
class_abstraction
Instantiating content class attribute0.00000.001650.0000
General
dbfile0.00080.1171170.0000
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
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs