validate(mixed $value, string $subPath = '', null|string|string[] $groups = null, bool $traverse = false, bool $deep = false) deprecated
deprecated
since version 2.5, to be removed in 3.0. Use {@link Context\ExecutionContextInterface::getValidator()} instead.
Validates the given value within the scope of the current validation.
The value may be any value recognized by the used metadata factory (see {@link MetadataFactoryInterface::getMetadata}), or an array or a traversable object of such values.
Usually you validate a value that is not the current node of the execution context. For this case, you can pass the {@link $subPath} argument which is appended to the current property path when a violation is created. For example, take the following object graph:
(Person)---($address: Address)---($phoneNumber: PhoneNumber) ^
When the execution context stops at the Person instance, the property path is "address". When you validate the PhoneNumber instance now, pass "phoneNumber" as sub path to correct the property path to "address.phoneNumber":
$context->validate($address->phoneNumber, 'phoneNumber');
Any violations generated during the validation will be added to the violation list that you can access with {@link getViolations}.
Please login to continue.