EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

setDefaultSort by date and ignore null values

Open bastien70 opened this issue 11 months ago • 1 comments

Hello, in my controller I've :

    public function configureCrud(Crud $crud): Crud
    {
        return parent::configureCrud($crud)
            ->setDefaultSort(['sentForValidationAt' => 'ASC'])
        ;
    }

So I want to sort by default on a datetime property, to display on top the rows with the min date value. But it displays rows with null values, and I want to ignore "null values" from the default sort. Is it possible ?

bastien70 avatar Mar 25 '25 11:03 bastien70

see https://symfony.com/bundles/EasyAdminBundle/current/crud.html#customizing-crud-actions

Define a custom method createIndexQueryBuilder (and ignore null values)

pfpro avatar Mar 25 '25 12:03 pfpro