Validates a value.
The accepted values depend on the {@link MetadataFactoryInterface} implementation.
@api
mixed $value The value to validate:
array|null $groups The validation groups to validate.:
Boolean $traverse Whether to traverse the value if it is traversable.:
Boolean $deep Whether to traverse nested traversable values recursively.:
ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded.
Overrides ValidatorInterface::validate
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();
}