Question

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();

Relation

Was it helpful?

Solution 2

Make sure you set the storage pid in your plugins Typoscript or disable the respectStoragePid in your repository.

=)

OTHER TIPS

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);
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top