[TYPO3-mvc] extbase SetOrderings doesn't work

Michael Knoll mimi at kaktusteam.de
Mon Jan 24 16:15:24 CET 2011


Hi Johannes,

for me this works as you described it - except the part that for me it 
also outputs the right sorting :)

If the SQL query is correct then there should be another error - hm?

Can you output the result of the query and the array of domain objects 
you get back? They won't be sorted after the database query is executed. 
So if the query is correct, the order of the objects should be correct.

Greetings

Mimi


Am 24.01.11 15:53, schrieb Johannes C. Schulz - EnzephaloN IT-Solutions:
> Hey there
>
>
>
> I started to do my first experiences with extbase and fluid. But now, no
> book and no community is able to help me out of this problem.
>
> My Controller and Repositories are working fine, but not the Orderings of
> the repository! It always orders by Uid descending!!
>
>
>
> BandRepository.php:
>
> .
>
> public function listOfBandsInYearBy($year,$sortby,$sorttype){
>
>        $frage = $this->createQuery();
>
>        $frage ->  getQuerySettings()->setRespectEnableFields(TRUE);
>
>        if($sortby=='ORDER_ASCENDING'){
>
>                  $frage->matching($frage->equals('year',$year) );
>
>                  $frage->setOrderings(array($sorttype =>
> Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING) );
>
>        return $frage->execute();
>
>        }
>
>        else{
>
>                  $frage->matching($frage->equals('year',$year) );
>
>                  $frage->setOrderings(array($sorttype =>
> Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING) );
>
>        return $frage->execute();
>
>        }
>
> }
>
> .
>
>
>
> $sorttype can be 'name' (string) or 'dateadded' (int). (comes from Flexform)
>
> $sortby can be 'ORDER_ASCENDING' or 'ORDER_DESCENDING' (comes from Flexform)
>
> $year also comes from flexform
>
>
>
> I also tried to replace $sorttype by 'name' or 'dateadded'.
>
> I installed DevLog to see the SQL-Statement generated by extbase. It was
> totally correct! But the frontend shows always the wrong sorting!
>
>
>
> Can anybody help me out from this problem?
>
>
>
> Best regards!
>
> Johannes
>



More information about the TYPO3-project-typo3v4mvc mailing list