lib/Validator/ValidatorTrait.php
protected function validate($value, $constraints, ?string $propertyPath = null): void
    {
        try {
            $violations = $this->validator->validate($value, $constraints);
        } catch (Throwable $t) {
            throw ValidationException::validationFailed($propertyPath ?? '', $t->getMessage(), $t);
        }

        if (count($violations) === 0) {
            return;
        }

        $propertyName = $violations[0]->getPropertyPath() ?? '';
        if ($propertyName === '') {
            $propertyName = $propertyPath ?? '';
        }

        throw ValidationException::validationFailed($propertyName, $violations[0]->getMessage());
    }
protected function validate($value, $constraints, ?string $propertyPath = null): void
    {
        try {
            $violations = $this->validator->validate($value, $constraints);
        } catch (Throwable $t) {
            throw ValidationException::validationFailed($propertyPath ?? '', $t->getMessage(), $t);
        }

        if (count($violations) === 0) {
            return;
        }

        $propertyName = $violations[0]->getPropertyPath() ?? '';
        if ($propertyName === '') {
            $propertyName = $propertyPath ?? '';
        }

        throw ValidationException::validationFailed($propertyName, $violations[0]->getMessage());
    }
protected function validate ( $ value , $ constraints , ? string $ propertyPath = null ) : void { try { $ violations = $ this -> validator -> validate ( $ value , $ constraints ) ; } catch ( Throwable $ t ) { throw ValidationException :: validationFailed ( $ propertyPath ?? '' , $ t -> getMessage ( ) , $ t ) ; } if ( count ( $ violations ) === 0 ) { return ; } $ propertyName = $ violations [ 0 ] -> getPropertyPath ( ) ?? '' ; if ( $ propertyName === '' ) { $ propertyName = $ propertyPath ?? '' ; } throw ValidationException :: validationFailed ( $ propertyName , $ violations [ 0 ] -> getMessage ( ) ) ; }
Validates the value against a set of provided constraints.

@param mixed $value
@param \Symfony\Component\Validator\Constraint|\Symfony\Component\Validator\Constraint[] $constraints
@param string $propertyPath

@throws \Netgen\BlockManager\Exception\Validation\ValidationException If the validation failed
Validates the value against a set of provided constraints .