You are here

public function RecursiveValidator::validate in Plug 7

Validates a value against a constraint or a list of constraints.

If no constraint is passed, the constraint {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.

Parameters

mixed $value The value to validate:

Constraint|Constraint[] $constraints The constraint(s) to validate: against

array|null $groups The validation groups to: validate. If none is given, "Default" is assumed

Return value

ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded

Overrides ValidatorInterface::validate

2 calls to RecursiveValidator::validate()
LegacyValidator::validate in lib/Symfony/validator/Symfony/Component/Validator/Validator/LegacyValidator.php
Validates a value against a constraint or a list of constraints.
LegacyValidator::validateValue in lib/Symfony/validator/Symfony/Component/Validator/Validator/LegacyValidator.php
Validates a value against a constraint or a list of constraints.
1 method overrides RecursiveValidator::validate()
LegacyValidator::validate in lib/Symfony/validator/Symfony/Component/Validator/Validator/LegacyValidator.php
Validates a value against a constraint or a list of constraints.

File

lib/Symfony/validator/Symfony/Component/Validator/Validator/RecursiveValidator.php, line 113

Class

RecursiveValidator
Recursive implementation of {@link ValidatorInterface}.

Namespace

Symfony\Component\Validator\Validator

Code

public function validate($value, $constraints = null, $groups = null) {
  return $this
    ->startContext($value)
    ->validate($value, $constraints, $groups)
    ->getViolations();
}