Class

Symfony\Component\Validator\Validator

class Validator implements ValidatorInterface

The default implementation of the ValidatorInterface.

This service can be used to validate objects, properties and raw values against constraints.

Methods

__construct(ClassMetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $validatorInitializers = array())

ClassMetadataFactoryInterface getMetadataFactory()

Returns the factory for ClassMetadata instances

ConstraintViolationList validate(object $object, array|null $groups = null)

Validate the given object.

ConstraintViolationList validateProperty(object $object, string $property, array|null $groups = null)

Validate a single property of an object against its current value.

ConstraintViolationList validatePropertyValue(string $class, string $property, string $value, array|null $groups = null)

Validate a single property of an object against the given value.

ConstraintViolationList validateValue(mixed $value, Constraint $constraint, array|null $groups = null)

Validates a given value against a specific Constraint.

Details

at line 33
public __construct(ClassMetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $validatorInitializers = array())

Parameters

ClassMetadataFactoryInterface $metadataFactory
ConstraintValidatorFactoryInterface $validatorFactory
array $validatorInitializers

at line 47
public ClassMetadataFactoryInterface getMetadataFactory()

Returns the factory for ClassMetadata instances

at line 57
public ConstraintViolationList validate(object $object, array|null $groups = null)

Validate the given object.

Parameters

object $object The object to validate
array|null $groups The validator groups to use for validating

Return Value

ConstraintViolationList

at line 73
public ConstraintViolationList validateProperty(object $object, string $property, array|null $groups = null)

Validate a single property of an object against its current value.

Parameters

object $object The object to validate
string $property The name of the property to validate
array|null $groups The validator groups to use for validating

Return Value

ConstraintViolationList

at line 89
public ConstraintViolationList validatePropertyValue(string $class, string $property, string $value, array|null $groups = null)

Validate a single property of an object against the given value.

Parameters

string $class The class on which the property belongs
string $property The name of the property to validate
string $value
array|null $groups The validator groups to use for validating

Return Value

ConstraintViolationList

at line 105
public ConstraintViolationList validateValue(mixed $value, Constraint $constraint, array|null $groups = null)

Validates a given value against a specific Constraint.

Parameters

mixed $value The value to validate
Constraint $constraint The constraint to validate against
array|null $groups The validator groups to use for validating

Return Value

ConstraintViolationList