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

SF6: Error using Filters: Symfony\Component\PropertyAccess\PropertyAccessor::isReadable(): Argument #1 ($objectOrArray) must be of type object|array, null given #4903

Closed
BOAWEB opened this issue Dec 15, 2021 · 7 comments

Comments

@BOAWEB
Copy link

BOAWEB commented Dec 15, 2021

Describe the bug
I upgraded to SF6(.0.1) and EasyAdmin 4.0.1. When using the filters in the backend (through the modal window), I get the following error:
Symfony\Component\PropertyAccess\PropertyAccessor::isReadable(): Argument #1 ($objectOrArray) must be of type object|array, null given, called in vendor/easycorp/easyadmin-bundle/src/Field/Configurator/CommonPreConfigurator.php on line 93

To Reproduce
SF6(.0.1), EasyAdmin 4(.0.1), set filters in Crud index.

@javiereguiluz javiereguiluz added this to the 4.x milestone Dec 15, 2021
@ben29
Copy link

ben29 commented Dec 15, 2021

@BOAWEB same here..

using php 8.1 and Symfony 6.0.1

@timsweb
Copy link

timsweb commented Dec 17, 2021

I've got a bit of a hack to work around this:

    public function renderFilters(AdminContext $context): KeyValueStore
    {
        if (null === $context->getEntity()->getInstance()) {
            $context->getEntity()->setInstance(new (self::getEntityFqcn()));
        }
        return parent::renderFilters($context); 
    }

@javiereguiluz
Copy link
Collaborator

Thanks for reporting. Please, try the fix proposed in #4910 (it fixed the problem for me).

javiereguiluz added a commit that referenced this issue Dec 18, 2021
This PR was squashed before being merged into the 4.0.x-dev branch.

Discussion
----------

Fix some issues related to filters

Fixes #4903.

Commits
-------

ac3ac2b Fix some issues related to filters
@ToshY
Copy link

ToshY commented Jan 14, 2022

@javiereguiluz I can confirm this now works in SF 6 (PHP 8.1) with the latest release 4.0.2.

@javiereguiluz
Copy link
Collaborator

Closing as fixed in #4910.

@ciekals11
Copy link

ciekals11 commented Dec 20, 2022

Still experiencing similar issue

Symfony\Component\PropertyAccess\PropertyAccessor::isReadable(): Argument #1 ($objectOrArray) must be of type object|array, null given, called in /app/vendor/easycorp/easyadmin-bundle/src/Field/Configurator/AssociationConfigurator.php on line 269

php: 8.1
symfony: v6.2.2
easyadmin-bundle: v4.4.5

Adding "hack" mentioned by @timsweb helps,

@BOAWEB
Copy link
Author

BOAWEB commented Dec 20, 2022 via email

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

No branches or pull requests

6 participants