ExecutionContext deprecated::validateValue()

validateValue(mixed $value, Constraint|Constraint[] $constraints, string $subPath = '', null|string|string[] $groups = null)

Validates a value against a constraint.

Use the parameter $subPath to adapt the property path for the validated value. For example, take the following object graph:

(Person)---($address: Address)---($street: string)
                    ^

When the validator validates the Address instance, the property path stored in the execution context is "address". When you manually validate the property $street now, pass the sub path "street" to adapt the full property path to "address.street":

$context->validate($address->street, new NotNull(), 'street');

Parameters

mixed $value The value to validate.
Constraint|Constraint[] $constraints The constraint(s) to validate against.
string $subPath The path to append to the context's property path.
null|string|string[] $groups The groups to validate in. If you don't pass any groups here, the current group of the context will be used.
doc_Symfony
2016-10-28 06:15:45
Comments
Leave a Comment

Please login to continue.