ValidationVisitorInterface deprecated::validate()

validate(mixed $value, string $group, string $propertyPath, bool $traverse = false, bool $deep = false)

Validates a value.

If the value is an array or a traversable object, you can set the parameter $traverse to true 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 $deep to true as well.

If you set $traversable to true, 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 $traversable to true and the visitor does not find metadata for the given value, it will fail with an exception.

Parameters

mixed $value The value to validate.
string $group The validation group to validate.
string $propertyPath The current property path in the validation graph.
bool $traverse Whether to traverse the value if it is traversable.
bool $deep Whether to traverse nested traversable values recursively.

Exceptions

NoSuchMetadataException If no metadata can be found for the given value.
doc_Symfony
2016-10-28 06:36:34
Comments
Leave a Comment

Please login to continue.