[TYPO3-mvc] *Store* sorting a of relation

Dirk Rauscher dr_typo3 at itb-institut.de
Fri Mar 2 14:10:40 CET 2012


I assume you have a 'documentgroup' object that holds the 'documents'. 
And a 'user' object which has one or more 'documentgroups' to handle the 
user's documents.

So I would add a 'sorting' field to the 'documentsgroup' object and use 
it when querying the documents with a repository method eg. 
findByDocumentgroup() instead of adding the sorting to the MM table.

$query->setOrderings(array('mySortingField' => 
Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING))

How about that?


Kind regards,
Dirk



Am 02.03.2012 13:46, schrieb Lorenz Ulrich:
> Hi Dirk
>
>  > afaik the sorting is handled by TCA. In the 'ctrl' section of your
>  > documents table you can set the 'sortby' or 'default_sortby' property.
>
> This is partially right (it's handled by TCA, but not respected by
> Extbase), but I want to *store* the sorting order of the child elements
> based on user input.
>
> So the user sorts the child objects (by drag and drop) and this should
> be saved in the MM table.
>
> Best regards,
>
> Lorenz
>
> Am 02.03.2012 13:06, schrieb Dirk Rauscher:
>> Hi Lorenz,
>>
>> afaik the sorting is handled by TCA. In the 'ctrl' section of your
>> documents table you can set the 'sortby' or 'default_sortby' property.
>>
>> Or did I get you wrong?
>>
>> Dirk
>>
>>
>>
>> Am 21.02.2012 10:26, schrieb Lorenz Ulrich:
>>> Hi everyone
>>>
>>> I just wanted to ask if anyone figured out how the sorting of a relation
>>> could be stored in the mm table.
>>>
>>> From the non-Extbase POV:
>>> When I e.g. attach DAM documents to a tt_news entry, I can sort these
>>> documents and the sorting is stored in tx_dam_mm_ref in
>>> "sorting_foreign".
>>>
>>> Now I would like to do the same in an Extbase extension: Add "documents"
>>> to a "group of documents" and store the sorting order in the mm table.
>>> But I can't find any (proper) way to pass the sorting value to Extbase.
>>> And it's impossible to just set the sorting manually after adding the
>>> relations because they (all of them) are deleted and newly written each
>>> time one relation is added or deleted.
>>>
>>> Is this such a weird scenario or is it known to be a missing feature?
>>>
>>> Thanks for any input on this topic and best regards,
>>>
>>> Lorenz
>>
>



More information about the TYPO3-project-typo3v4mvc mailing list