Symfony2 API
Interface

Symfony\Component\Validator\ValidatorContextInterface

interface ValidatorContextInterface

Stores settings for creating a new validator and creates validators

The methods in this class are chainable, i.e. they return the context
object itself. When you have finished configuring the new validator, call
getValidator() to create the it.

<code>
$validator = $context
->setClassMetadataFactory($customFactory)
->getValidator();
</code>

Methods

setClassMetadataFactory(ClassMetadataFactoryInterface $classMetadataFactory)

Sets the class metadata factory used in the new validator

setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $constraintValidatorFactory)

Sets the constraint validator factory used in the new validator

ValidatorInterface getValidator()

Creates a new validator with the settings stored in this context

Details

at line 38
public setClassMetadataFactory(ClassMetadataFactoryInterface $classMetadataFactory)

Sets the class metadata factory used in the new validator

Parameters

ClassMetadataFactoryInterface $classMetadataFactory The factory instance

at line 45
public setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $constraintValidatorFactory)

Sets the constraint validator factory used in the new validator

Parameters

ConstraintValidatorFactoryInterface $constraintValidatorFactory The factory instance

at line 52
public ValidatorInterface getValidator()

Creates a new validator with the settings stored in this context

Return Value

ValidatorInterface The new validator