I have an extension (extbase/fluid) with an main object "Etikett" with a relation to a child object "Land". I want to order my output, so I'm using the setDefaultOrderings method in my Etikett controller, but I got no results, why?
$this->etikettRepository->setDefaultOrderings(array('land.laendername' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING));
$etiketts = $this->etikettRepository->findAll();
You can set default order in your Repository.
class etikettRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/*
* Default ordering for all queries created by this repository
*/
protected $defaultOrderings = array(
'your_field_name' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
);
public function findAll(){
//Your query
$query->getQuerySettings()->setRespectStoragePage(FALSE);
}
}
Make sure you set the storage pid in your plugins Typoscript or disable the respectStoragePid in your repository.
=)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With