[TYPO3-mvc] $query->setOrderings and no results

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Jan 20 23:44:48 CET 2011


Hey Raymund,

> I want to set ordering on the results of the projects.
>
>          public function findAll()
>          {
>                  t3lib_div::devLog('Projects: findAll', 'utek_referenzen', 0);
>                  $query = $this->createQuery();
>                  $result = $query->execute();
>          t3lib_div::devLog('result:' . $result->count(), 'utek_referenzen',0);
>                  $query->setOrderings(
>                          array (
> //                              'customer.name' =>  Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING,
>                                  'enddate' =>  Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING,
>                                  'startdate' =>  Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING,
>                          )
>                  );
>                  return $result;
>          }
>
> This works just fine. But as soon as I uncomment the line with
> 'customer.name' I get no results at all. I saw an example in the book
> of Jochen and Sebastian that uses that method with 'organization.name'
> and would like to use it as well.

First, from a logical point of view you should call the ->execute method 
AFTER $query->setOrderings (not sure if calling it before has some 
sideeffects with the query result object). Second, it should work just 
fine with customer.name. What relation type have you configured for the 
customer property in your products object?

Could you debug the resulting query in 
Tx_Extbase_Persistence_Storage_Typo3DbBackend?

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list