[TYPO3-mvc] Feature #6165 - The repository's findAll() shall honour "default_sortby" defined in TCA

Dmitri Pisarev dimaip at gmail.com
Thu Apr 29 16:50:05 CEST 2010


On 29.04.2010 16:34, Steffen Ritter wrote:
> Am 29.04.2010 12:46, schrieb Dmitri Pisarev:
>> On 29.04.2010 13:47, Steffen Ritter wrote:
>>> Am 29.04.2010 11:43, schrieb Dmitri Pisarev:
>>>> I have come up to the obvious need - to sort all of my objects by
>>>> title.
>>>> And not only findAll but also findBy* and all of the other magic
>>>> methods.
>>>> When shall this feature request be completed and what shall I do while
>>>> it has not been done?
>>>>
>>>> Regards,
>>>> Dmitri.
>>> Hey Dmitry,
>>> this technically is not possible.
>>> I already tried this.
>>> the default_sortby does not contain the fieldname things like "sort by
>>> xyz ASC, zyx, DESC" etc.
>>> So This would have to be parsed splitted up and then used. SInce all SQL
>>> is allowed in TCA at this point (dirty implementation) this nearly seems
>>> to be impossible.
>>>
>>> regards
>>> Steffen
>> Hi Steffen,
>> sorry, I didn't get why it is not possible to implement.
> The query object would have to implement SQl Parsing... Furthermore
> there would have been a "hidden" logic if automatic sorting would be
> introduced via an not as sortfield defined string.
>
> Nevertheless,
>> how to do it then? How to set the default sorting in any other way?
>> Don't tell me I have to rewrite all of the repositories with my own
>> findAll...
>
> Well from which place should Extbase now how to sort it :) Even if you
> define "date" or "composer" as default_sortby for your overview in
> backend as default sorting, you will list them sorted alphabetically in
> frontend.
>
> Extbase automatically honours "sorting" since that just holds a field
> name. the "default_sortby" ist just for BE usage in list view as the
> "primary" sorting of the record list.
> It applies nowhere else automatically. "piBase" Extensions or anything
> else do not honour it too...
> What might be possible is "sort by title" since this would be an unique
> field (ignoring alternate_title and force alternate). But i think that's
> not wanted at all too.
>
>
> findAll is a "helper". But it's not useful in real projects...
> Franz seid already the right about this topic: Own Abstract Repository!
> The repository class was never meant to be class to use solely but as
> base-class to extend.
>
> Extbase supports Extensiondeveloping and quering quite well, it does not
> replace the developer or brain-usage ;)
>
> regards
>
> Steffen

Steffen, thanks a lot for the detailed reply! Now I start to get it.
I shall indeed create my own Abstract repository, as you suggest.
Although if it was posible to honor 'default_sortby' it would save me 
like 15 min per each object. The 'convention over configuration' is a 
very good approach for small scale projects like mine...

Cheers,
Dmitri.


More information about the TYPO3-project-typo3v4mvc mailing list