[TYPO3-mvc] extbase SetOrderings doesn't work

Johannes C. Schulz - EnzephaloN IT-Solutions info at enzephalon.de
Mon Jan 24 15:53:48 CET 2011


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