[TYPO3-mvc] $query->setOrderings not working for foreign table not working

Raju Makwana raju at drcsystems.com
Wed Aug 7 20:46:56 CEST 2013


Hello,

I have a problem with ordering functionality on foreign table field.
I want to show the listing of Products in which there is one field categoryname from ProductCategory table.

I want to apply the ordering functionality on categoryname field in listing of products.

so how can i do with extbase extension?

I created the MM relationship between Products and ProductCategory table. categoryname field is displayed in listing but ordering is not working on it.

In Products repository i created the below function:

public function getData($args) {  

    $query = $this->createQuery();            

    $result =   $query->setOrderings(array('ProductCategory.categoryname' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING ))->execute();

       return $result;        
}
However it is not working for me. If i remove the setOrderings function then listing works fine otherwise it throws an error. It seems that setOrdering function not working with foreign table.

I tried many ways and find many solutions but no luck :(

I need to solve it very urgently. Any help will be greatly appreciated.

Thanks,
Jignesh


More information about the TYPO3-project-typo3v4mvc mailing list