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

Lorenz Ulrich lorenz-typo3 at visol.ch
Fri Mar 2 14:59:50 CET 2012


Hi Dirk

I have the following situation:

- An "exhibition" object
-- having a relation to n "group of works" objects
--- which have a relation to n "work" objects

When adding works to a "group of works", I want to store the sorting of 
these works inside the "group of works". I don't know how I could store 
that sorting in a field in the "group of works" table.

At the same time I cannot store the sorting inside the "work" table 
because there are other objects relating to the "work" table, e.g.

- An "artist" object
-- having a relation to n "work" objects

The artist may have another sorting of his works than the "gallery 
owner" creating topic-based groups of works.

Do I miss something?

Thanks for contributing.

Lorenz

Am 02.03.2012 14:10, schrieb Dirk Rauscher:
> 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