EasyCorp / EasyAdminBundle

EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
MIT License
4.09k stars 1.03k forks source link

[3.3.1]fn configureCrud() $crud->setFilters() #4406

Open aegladkikh opened 3 years ago

aegladkikh commented 3 years ago

Hi, i try to use this:

public function configureCrud(Crud $crud): Crud { return $crud ->setFilters([]) ->setPaginatorPageSize(30); }

the setFilters function takes an array or null as arguments.

in the code of the function itself, $ this-> dto-> setFiltersConfig ($ filters) is called;

and here $ filters should be FilterConfigDto $ filterConfig

from here I get the type mismatch execution.

Log:

EasyCorp\Bundle\EasyAdminBundle\Dto\CrudDto::setFiltersConfig(): Argument #1 ($filterConfig) must be of type EasyCorp\Bundle\EasyAdminBundle\Dto\FilterConfigDto, array given, called in /app/vendor/easycorp/easyadmin-bundle/src/Config/Crud.php on line 227

Julen10 commented 3 years ago

Have you tried using configureFilters function?

public function configureFilters(Filters $filters): Filters
    {
        return $filters
            ->add('title')
            ->add('price')
            ->add('published')
        ;
    }
aegladkikh commented 3 years ago

Okay I will try

Dallas62 commented 3 years ago

Hi, I can confirm there is a typing issue: image From master via Github: image https://github.com/EasyCorp/EasyAdminBundle/blob/master/src/Config/Crud.php#L234 Regards