interface ValidatorInterface implements MetadataFactoryInterface
Validates PHP values against constraints.
MetadataInterface | getMetadataFor(mixed $value) Returns the metadata for the given value. | from MetadataFactoryInterface |
bool | hasMetadataFor(mixed $value) Returns whether the class is able to return metadata for the given value. | from MetadataFactoryInterface |
ConstraintViolationListInterface | validate(mixed $value, Constraint|Constraint[] $constraints = null, string|GroupSequence|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. | |
ConstraintViolationListInterface | validateProperty(object $object, string $propertyName, string|GroupSequence|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. | |
ConstraintViolationListInterface | validatePropertyValue(object|string $objectOrClass, string $propertyName, mixed $value, string|GroupSequence|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. | |
ContextualValidatorInterface | startContext() Starts a new validation context and returns a validator for that context. | |
ContextualValidatorInterface | inContext(ExecutionContextInterface $context) Returns a validator in the given execution context. |
Returns the metadata for the given value.
mixed | $value | Some value |
MetadataInterface | The metadata for the value |
NoSuchMetadataException | If no metadata exists for the given value |
Returns whether the class is able to return metadata for the given value.
mixed | $value | Some value |
bool | Whether metadata can be returned for that value |
Validates a value against a constraint or a list of constraints.
If no constraint is passed, the constraint {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
mixed | $value | The value to validate |
Constraint|Constraint[] | $constraints | The constraint(s) to validate against |
string|GroupSequence|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed |
ConstraintViolationListInterface | A list of constraint violations If the list is empty, validation succeeded |
Validates a property of an object against the constraints specified for this property.
object | $object | The object |
string | $propertyName | The name of the validated property |
string|GroupSequence|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed |
ConstraintViolationListInterface | A list of constraint violations If the list is empty, validation succeeded |
Validates a value against the constraints specified for an object's property.
object|string | $objectOrClass | The object or its class name |
string | $propertyName | The name of the property |
mixed | $value | The value to validate against the property's constraints |
string|GroupSequence|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed |
ConstraintViolationListInterface | A list of constraint violations If the list is empty, validation succeeded |
Starts a new validation context and returns a validator for that context.
The returned validator collects all violations generated within its context. You can access these violations with the {@link ContextualValidatorInterface::getViolations()} method.
ContextualValidatorInterface | The validator for the new context |
Returns a validator in the given execution context.
The returned validator adds all generated violations to the given context.
ExecutionContextInterface | $context |
ContextualValidatorInterface | The validator for that context |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Validator/Validator/ValidatorInterface.html