Skip to content

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

@w1nsun

Description

@w1nsun

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy