[TYPO3-mvc] extbase and 'foreign_sortby'

Stefan Neufeind typo3.neufeind at speedpartner.de
Mon Jun 6 12:28:56 CEST 2011


On 06/06/2011 12:24 PM, Michal Cygankiewicz wrote:
> Is it correctly that extbase doesn't pays attention to orderings in
> foreign_sortby?
> 
> 
> In my extbase extension tca configuration I have:
> 
>         'standings' => array(
> .........
>             'config' => array(
>                 'type' => 'inline',
>                 'foreign_table' => 'tx_mcvolley_domain_model_standingitem',
>                 'foreign_field' => 'standing',
>                 'foreign_sortby' => 'points desc',
>                 'maxitems'      => 9999,
>             ),
>         ),
> 
> 
> Sorting in backend is done correctlly. In fronted, error is occuring
> because of incorrect statement in order by:

[...]

> tx_mcvolley_domain_model_standingitem.sys_language_uid IN (0,-1) ORDER
> BY tx_mcvolley_domain_model_standingitem.points desc ASC
> 
> 
> 
> Why extbase adds "ASC" as orderings, even if i specify "desc" in TCA?

[...]

Hi,

it's currently hardcoded to ascending in
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php
inside getPreparedQuery()

There it says:
if ($columnMap->getChildSortByFieldName() !== NULL) {
  $query->setOrderings(array($columnMap->getChildSortByFieldName() =>
Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
}

Related post on the mailinglist:
http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2010-October/007035.html

No decision was yet made about this. I've filed a bug-report to keep track:
http://forge.typo3.org/issues/27248

-- 

Kind regards,
 Stefan Neufeind


More information about the TYPO3-project-typo3v4mvc mailing list