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

BooleanField requires 0 arguments, but should accept only 1 #6576

Open
ben29 opened this issue Nov 26, 2024 · 0 comments
Open

BooleanField requires 0 arguments, but should accept only 1 #6576

ben29 opened this issue Nov 26, 2024 · 0 comments

Comments

@ben29
Copy link

ben29 commented Nov 26, 2024

HI.

I generate new User class via Symfony command.

php bin/console make:user

my User Class (the same like what Symfony generate).

----
    #[ORM\Column]
    private bool $isVerified = false;

    public function isVerified(): bool
    {
        return $this->isVerified;
    }

    public function setVerified(bool $isVerified): static
    {
        $this->isVerified = $isVerified;

        return $this;
    }

and config easyadmin to use:

    public function configureFields(string $pageName): iterable
    {
        return [
            IdField::new('id')->hideWhenCreating(),
            EmailField::new('email'),
            BooleanField::new('isVerified'),
        ];
    }

I'm getting error when I'm trying to update the user.

The method "isVerified" in class "App\Entity\User" requires 0 arguments, but should accept only 1.. Make the property public, add a setter, or set the "mapped" field option in the form type to be false.

it's look the Easyadmin try to use isVerified method, instead of the "setVerified"

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

No branches or pull requests

1 participant