RecursiveValidator::validate

public RecursiveValidator::validate($value, $constraints = NULL, $groups = NULL)

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

File

core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php, line 88

Class

RecursiveValidator
Defines a recursive validator for Typed Data.

Namespace

Drupal\Core\TypedData\Validation

Code

public function validate($value, $constraints = NULL, $groups = NULL) {
  return $this->startContext($value)
    ->validate($value, $constraints, $groups)
    ->getViolations();
}
doc_Drupal
2016-10-29 09:36:50
Comments
Leave a Comment

Please login to continue.