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

Patrick Schriner patrick.schriner at diemedialen.de
Mon Mar 5 16:25:45 CET 2012


Just out of curiosity - what is keeping you from using a "sorting" column  
in the M:N table?

Couldn't you fetch the (unsorted) model first, and sort later - maybe  
using a simplified model that uses the m:n table as a basis?

On Mon, 05 Mar 2012 15:45:27 +0100, Lorenz Ulrich <lorenz-typo3 at visol.ch>  
wrote:

> Hi Dirk
>
> The frontend isn't the problem at all... in fact I'm using a JQuery  
> callback of a sortable accordion to set the position to a hidden field.
>
> The problem is to store it in the MM database table. I had a short  
> conversation with Claus Due and he confirmed that it's just not possible  
> to do ATM.
>
> I think I will need to manipulate my model to get that stuff done.
>
> Best regards,
>
> Lorenz
>
> Am 05.03.2012 11:52, schrieb Dirk Rauscher:
>> Hi Lorenz
>>
>> again I assume the following situation:
>>
>> Your 'group of works' object lists the assigned 'work' objects in the
>> frontend. The frontend users then clicks on e.g. the property name to
>> sort them by name.
>>
>> You can either store the click event in a variable of the form and
>> submit it when the fe user clicks the 'save' button. Or submit it with
>> an ajax call directly.
>>
>> Of course this requires javascript to do the job. If JS isn't enabled
>> you use a default sorting.
>>
>> --------------------------------
>> <form name="xxx" method="xxx">
>> ....
>> ....
>>
>> <input type="hidden" name="tx_yourExt_pi1[mySorting]" value="name ASC">
>> </form>
>> --------------------------------
>>
>> Dirk
>>
>>
>>
>> Am 02.03.2012 14:59, schrieb Lorenz Ulrich:
>>> 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
>>>>
>>>>
>>>>
>

Patrick Schriner
-- 

--
Patrick Schriner


More information about the TYPO3-project-typo3v4mvc mailing list