Symfony\Component\Validator\ExecutionContextInterface::validateValue
Validates a value against a constraint.
Use the parameter <tt>$subPath</tt> to adapt the property path for the validated value. For example, take the following object graph: <pre> (Person)---($address: Address)---($street: string) ^ </pre> When the validator validates the <tt>Address</tt> instance, the property path stored in the execution context is "address". When you manually validate the property <tt>$street</tt> now, pass the sub path "street" to adapt the full property path to "address.street": <pre> $context->validate($address->street, new NotNull(), 'street'); </pre>
Signature
public function validateValue(mixed
$value,
[array
$constraints = '',
[string
$subPath = '',
[array
$groups = null]]] )
Parameters
$value
— mixed- The value to validate.
$constraints
— array- The constraint(s) to validate against.
$subPath
— string- The path to append to the context's property path.
$groups
— array- The groups to validate in. If you don't pass any
groups here, the current group of the context
will be used.