Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntityFilter causing error with doctrine ORM 3.0 #6142

Closed
BigMichi1 opened this issue Feb 8, 2024 · 2 comments
Closed

EntityFilter causing error with doctrine ORM 3.0 #6142

BigMichi1 opened this issue Feb 8, 2024 · 2 comments
Labels
Milestone

Comments

@BigMichi1
Copy link
Contributor

Describe the bug
in some controllers i configure filters using the EntityFilter class similar to this one

public function configureFilters(Filters $filters): Filters
    {
        return $filters->add(EntityFilter::new('fireDepartments')->setLabel('entity.operation.fire.departments'))
            ->add(EntityFilter::new('operationType')->setLabel('entity.operation.type'))
            ->add(DateTimeFilter::new('operationDate')->setLabel('entity.operation.date'));
    }

when running my tests for this page where the filter is configured with an EntityFilter i'm getting

TypeError:
EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator\EntityConfigurator::EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator\{closure}(): Argument #1 ($joinColumn) must be of type array, Doctrine\ORM\Mapping\JoinColumnMapping given
  at vendor/easycorp/easyadmin-bundle/src/Filter/Configurator/EntityConfigurator.php:41
  at EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator\EntityConfigurator::EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator\{closure}()
  at array_filter()
     (vendor/easycorp/easyadmin-bundle/src/Filter/Configurator/EntityConfigurator.php:39)
  at EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator\EntityConfigurator->configure()
     (vendor/easycorp/easyadmin-bundle/src/Factory/FilterFactory.php:80)
  at EasyCorp\Bundle\EasyAdminBundle\Factory\FilterFactory->create()
     (vendor/easycorp/easyadmin-bundle/src/Controller/AbstractCrudController.php:130)
  at EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController->index()
     (vendor/symfony/http-kernel/HttpKernel.php:178)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:76)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:185)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (vendor/symfony/http-kernel/HttpKernelBrowser.php:61)
  at Symfony\Component\HttpKernel\HttpKernelBrowser->doRequest()
     (vendor/symfony/framework-bundle/KernelBrowser.php:157)
  at Symfony\Bundle\FrameworkBundle\KernelBrowser->doRequest()
     (vendor/symfony/browser-kit/AbstractBrowser.php:369)
  at Symfony\Component\BrowserKit\AbstractBrowser->request()
     (tests/Controller/Admin/AbstractAdminControllerTestCase.php:95)
  at App\Tests\Controller\Admin\AbstractAdminControllerTestCase->getBackendPage()
     (tests/Controller/Admin/AbstractAdminControllerTestCase.php:61)
  at App\Tests\Controller\Admin\AbstractAdminControllerTestCase->requestSearchView()
     (tests/Controller/Admin/GfwOperationControllerTest.php:50)
  at App\Tests\Controller\Admin\GfwOperationControllerTest->testSearch()
     (vendor/phpunit/phpunit/src/Framework/TestCase.php:1122)
  at PHPUnit\Framework\TestCase->runTest()
     (vendor/phpunit/phpunit/src/Framework/TestCase.php:654)
  at PHPUnit\Framework\TestCase->runBare()
     (vendor/phpunit/phpunit/src/Framework/TestRunner.php:104)
  at PHPUnit\Framework\TestRunner->run()
     (vendor/phpunit/phpunit/src/Framework/TestCase.php:488)
  at PHPUnit\Framework\TestCase->run()
     (vendor/phpunit/phpunit/src/Framework/TestSuite.php:340)
  at PHPUnit\Framework\TestSuite->run()
     (vendor/phpunit/phpunit/src/Framework/TestSuite.php:340)
  at PHPUnit\Framework\TestSuite->run()
     (vendor/phpunit/phpunit/src/Framework/TestSuite.php:340)
  at PHPUnit\Framework\TestSuite->run()
     (vendor/phpunit/phpunit/src/TextUI/TestRunner.php:63)
  at PHPUnit\TextUI\TestRunner->run()
     (vendor/phpunit/phpunit/src/TextUI/Application.php:198)
  at PHPUnit\TextUI\Application->run()
     (vendor/phpunit/phpunit/phpunit:104)
  at require('/builds/php/gfw-penig-symfony/vendor/phpunit/phpunit/phpunit')
     (bin/phpunit:10)  

To Reproduce
configure an EntityFilter on a controller together with Doctrine 3.0 and EasyAdmin 4.9.0

@ben29
Copy link

ben29 commented Feb 8, 2024

same here.

EntityFilter doesn't not support ORM 3.0

``EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator\EntityConfigurator::EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator{closure}(): Argument #1 ($joinColumn) must be of type array, Doctrine\ORM\Mapping\JoinColumnMapping given`

@javiereguiluz javiereguiluz added this to the 4.x milestone Feb 9, 2024
@javiereguiluz
Copy link
Collaborator

Closing as fixed in #6145.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants