[TYPO3-mvc] How to set the sort order for child objects (m-m relation)
g4-lisz at tonarchiv.ch
g4-lisz at tonarchiv.ch
Thu Aug 4 17:33:23 CEST 2011
On 08/04/2011 04:30 PM, Werner Stotter wrote:
> hi,
>
> have you tried setting the 'sorting' in the TCA of ext_tables.php?
>
> in my case this helped
>
> greetings
> werner
>
>
Hi Werner
Sadly this did not solve my problem.
The issue is that the ordering property belongs to the next but one
table. In SQL this would be a SORTY BY a row of a secondary joined table:
SELECT
h.name AS hospital_name
,d.name AS disease_name
,t.number AS disease_number
FROM
hospital h
JOIN
treatment t
ON
h.treatment=t.uid
JOIN
disease d
ON
t.disease=d.uid
ORDER BY
d.name
;
A 'foreign_table_where' => 'ORDER BY disease.name' statement in the
treatment table's TCA makes no sense because there is a 1:1 relation
between desease and treatment. In the hospital table's TCA i don't know
how to set the ordering by a property that belongs to the next but one
table...
I think i have to set a SQL statement by my own, but at which place do
i define this $query?
Thank you,
Till
>
>
> Am 04.08.2011 15:44, schrieb g4-lisz at tonarchiv.ch:
>> On 30.07.2011 03:57, g4-lisz at tonarchiv.ch wrote:
>>> Hello all
>>>
>>> I'm writing an extension for the following domain (simplified):
>>>
>>> Entities: Hospitals, treatments
>>> Value Objects: disease
>>>
>>> Every hospital has several treatments. Every treatment has one disease.
>>>
>>> Hospital is "aggregate root".
>>>
>>> A simple view which shows all treatments for a particular hospital
>>> could look like this:
>>>
>>> <f:for each="{hospital.treatments}" as="treatment">
>>> Disease: {treatment.disease.name} Treatments: {treatment.number}
>>> </f:for>
>>>
>>> I'd like to sort the results list by disease names.
>>>
>>> How can i achieve this?
>>>
>>> I know there's the possibility to set orderings for a query obejct.
>>>
>>> But in my case there's only one Repository for the aggregate root,
>>> namely "Hospitals". How to set orderings for subsidiary entities?
>>>
>>> Greetings,
>>> T
>> Really no one any idea?
>>
>> I think this is a quit common problem and there must be a common
>> solution?
>>
>> Any help will be much appreciated!
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
More information about the TYPO3-project-typo3v4mvc
mailing list