Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Validator] Constraint validator "Symfony\Component\Validator\Constraints\RequiredValidator" does not exist or is not enabled #36723

Copy link
Copy link
Closed
@w1nsun

Description

@w1nsun
Issue body actions

Symfony version(s) affected: 3.4.40

3.4.39 is OK

Description
I get an error: Constraint validator "Symfony\Component\Validator\Constraints\RequiredValidator" does not exist or is not enabled. Check the "validatedBy" method in your constraint class "Symfony\Component\Validator\Constraints\Required".
Line: 49
File: "/data/www/site/current/vendor/symfony/symfony/src/Symfony/Component/Validator/ContainerConstraintValidatorFactory.php"

How to reproduce

use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Required;
use Symfony\Component\Validator\Validator\ValidatorInterface;

//$this->validator - ValidatorInterface (service @validator)
$violations = $this->validator->validate($value, new All([
            new Collection([
                'email' => [
                    new NotBlank(),
                    new Email(),
                ],
                'verified' => [
                    new Required(),
                    new Choice(['strict' => true, 'choices' => [1, 0, "1", "0", true, false]]),
                ],
            ]),
        ]));

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.