class Validator implements ValidatorInterface

Default implementation of {@link ValidatorInterface}.

Methods

__construct(MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, TranslatorInterface $translator, $translationDomain = 'validators', array $objectInitializers = array())

No description

getMetadataFactory()

Returns the factory for metadata instances.

getMetadataFor($value)

{@inheritDoc}

validate(mixed $value, array|null $groups = null, Boolean $traverse = false, Boolean $deep = false)

Validates a value.

validateProperty(mixed $containingValue, string $property, array|null $groups = null)

Validates a property of a value against its current value.

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

Validate a property of a value against a potential value.

validateValue(mixed $value, Constraint|Constraint[] $constraints, array|null $groups = null)

Validates a value against a constraint or a list of constraints.

Details

at line line 51
__construct(MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, TranslatorInterface $translator, $translationDomain = 'validators', array $objectInitializers = array())

Parameters

MetadataFactoryInterface $metadataFactory
ConstraintValidatorFactoryInterface $validatorFactory
TranslatorInterface $translator
$translationDomain
array $objectInitializers

at line line 69
MetadataFactoryInterface getMetadataFactory()

Returns the factory for metadata instances.

Return Value

MetadataFactoryInterface The metadata factory.

at line line 77
getMetadataFor($value)

{@inheritDoc}

Parameters

$value

at line line 85
ConstraintViolationListInterface validate(mixed $value, array|null $groups = null, Boolean $traverse = false, Boolean $deep = false)

Validates a value.

The accepted values depend on the {@link MetadataFactoryInterface} implementation.

Parameters

mixed $value The value to validate
array|null $groups The validation groups to validate.
Boolean $traverse Whether to traverse the value if it is traversable.
Boolean $deep Whether to traverse nested traversable values recursively.

Return Value

ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded.

at line line 101
ConstraintViolationListInterface validateProperty(mixed $containingValue, string $property, array|null $groups = null)

Validates a property of a value against its current value.

The accepted values depend on the {@link MetadataFactoryInterface} implementation.

Parameters

mixed $containingValue The value containing the property.
string $property The name of the property to validate.
array|null $groups The validation groups to validate.

Return Value

ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded.

at line line 132
ConstraintViolationListInterface validatePropertyValue(string $containingValue, string $property, string $value, array|null $groups = null)

Validate a property of a value against a potential value.

The accepted values depend on the {@link MetadataFactoryInterface} implementation.

Parameters

string $containingValue The value containing the property.
string $property The name of the property to validate
string $value The value to validate against the constraints of the property.
array|null $groups The validation groups to validate.

Return Value

ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded.

at line line 161
ConstraintViolationListInterface validateValue(mixed $value, Constraint|Constraint[] $constraints, array|null $groups = null)

Validates a value against a constraint or a list of constraints.

Parameters

mixed $value The value to validate.
Constraint|Constraint[] $constraints The constraint(s) to validate against.
array|null $groups The validation groups to validate.

Return Value

ConstraintViolationListInterface A list of constraint violations. If the list is empty, validation succeeded.