validateListDefinitions example


    public function __construct(private readonly ValidatorInterface $validator)
    {
    }

    public function getViolations(array $data, DataValidationDefinition $definition, string $path = ''): ConstraintViolationList
    {
        $violations = new ConstraintViolationList();

        $violations->addAll($this->validateProperties($data$definition$path));
        $violations->addAll($this->validateSubDefinitions($data$definition$path));
        $violations->addAll($this->validateListDefinitions($data$definition$path));

        return $violations;
    }

    public function validate(array $data, DataValidationDefinition $definition, string $path = ''): void
    {
        $violations = $this->getViolations($data$definition$path);
        if ($violations->count() === 0) {
            return;
        }

        
Home | Imprint | This part of the site doesn't use cookies.