Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Dependency Injection not more working for Validators #60611

Closed as not planned
Closed as not planned
@ThomasTr

Description

@ThomasTr

Symfony version(s) affected

7.3.0

Description

Trying to upgrade to Version 7.3.0 and get the following error: "Too few arguments to function App\Validator\ProductValidator::__construct(), 0 passed in Projects/app/vendor/symfony/validator/ContainerConstraintValidatorFactory.php on line 49 and exactly 1 expected"

How to reproduce

My Constructor for my ProductValidator looks these:

    public function __construct(public EntityManagerInterface $entityManager)
    {
    }

The validator is called as assert via attributes in my DTO:

    #[AppAssert\Product]
    private array $productIds;

And validated here:

        /** @var T $dto */
        $dto        = $this->deserialize($this->extract($request), $type, $request);
        $violations = $this->validator->validate($dto);

Possible Solution

No response

Additional Context

In previous version this has worked. Has anything changed here?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions