Symfony\Component\Validator\ValidationVisitorInterface::validate
Validates a value.
If the value is an array or a traversable object, you can set the parameter <tt>$traverse</tt> to <tt>true</tt> in order to run through the collection and validate each element. If these elements can be collections again and you want to traverse them recursively, set the parameter <tt>$deep</tt> to <tt>true</tt> as well. If you set <tt>$traversable</tt> to <tt>true</tt>, the visitor will nevertheless try to find metadata for the collection and validate its constraints. If no such metadata is found, the visitor ignores that and only iterates the collection. If you don't set <tt>$traversable</tt> to <tt>true</tt> and the visitor does not find metadata for the given value, it will fail with an exception.
Signature
public function validate(mixed
$value,
[string
$group = false,
[string
$propertyPath = false,
[Boolean
$traverse = false,
[Boolean
$deep = false]]]] )
Parameters
$value
— mixed- The value to validate.
$group
— string- The validation group to validate.
$propertyPath
— string- The current property path in the validation graph.
$traverse
— object- Whether to traverse the value if it is traversable.
$deep
— object- Whether to traverse nested traversable values recursively.
Errors/Exceptions
-
NoSuchMetadataException
- If no metadata can be found for