You are here

public function Validator::validate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Validator.php \Symfony\Component\Validator\Validator::validate()

Validates a value.

The accepted values depend on the {@link MetadataFactoryInterface} implementation.

The signature changed with Symfony 2.5 (see {@link Validator\ValidatorInterface::validate()}. This signature will be disabled in Symfony 3.0.

Parameters

mixed $value The value to validate:

array|null $groups The validation groups to validate.:

bool $traverse Whether to traverse the value if it is traversable.:

bool $deep Whether to traverse nested traversable values recursively.:

Return value

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

Overrides ValidatorInterface::validate

File

vendor/symfony/validator/Validator.php, line 97

Class

Validator
Default implementation of {@link ValidatorInterface}.

Namespace

Symfony\Component\Validator

Code

public function validate($value, $groups = null, $traverse = false, $deep = false) {
  $visitor = $this
    ->createVisitor($value);
  foreach ($this
    ->resolveGroups($groups) as $group) {
    $visitor
      ->validate($value, $group, '', $traverse, $deep);
  }
  return $visitor
    ->getViolations();
}