class ValidatorBuilder implements ValidatorBuilderInterface

The default implementation of {@link ValidatorBuilderInterface}.

Methods

addObjectInitializer(ObjectInitializerInterface $initializer)

Adds an object initializer to the validator.

addObjectInitializers(array $initializers)

Adds a list of object initializers to the validator.

addXmlMapping(string $path)

Adds an XML constraint mapping file to the validator.

addXmlMappings(array $paths)

Adds a list of XML constraint mapping files to the validator.

addYamlMapping(string $path)

Adds a YAML constraint mapping file to the validator.

addYamlMappings(array $paths)

Adds a list of YAML constraint mappings file to the validator.

addMethodMapping(string $methodName)

Enables constraint mapping using the given static method.

addMethodMappings(array $methodNames)

Enables constraint mapping using the given static methods.

enableAnnotationMapping(Reader $annotationReader = null)

Enables annotation based constraint mapping.

disableAnnotationMapping()

Disables annotation based constraint mapping.

setMetadataFactory(MetadataFactoryInterface $metadataFactory)

Sets the class metadata factory used by the validator.

setMetadataCache(CacheInterface $cache)

Sets the cache for caching class metadata.

setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory)

Sets the constraint validator factory used by the validator.

setTranslator(TranslatorInterface $translator)

Sets the translator used for translating violation messages.

setTranslationDomain(string $translationDomain)

Sets the default translation domain of violation messages.

getValidator()

Builds and returns a new validator object.

Details

at line line 90
ValidatorBuilderInterface addObjectInitializer(ObjectInitializerInterface $initializer)

Adds an object initializer to the validator.

Parameters

ObjectInitializerInterface $initializer The initializer.

Return Value

ValidatorBuilderInterface The builder object.

at line line 100
ValidatorBuilderInterface addObjectInitializers(array $initializers)

Adds a list of object initializers to the validator.

Parameters

array $initializers The initializer.

Return Value

ValidatorBuilderInterface The builder object.

at line line 110
ValidatorBuilderInterface addXmlMapping(string $path)

Adds an XML constraint mapping file to the validator.

Parameters

string $path The path to the mapping file.

Return Value

ValidatorBuilderInterface The builder object.

at line line 124
ValidatorBuilderInterface addXmlMappings(array $paths)

Adds a list of XML constraint mapping files to the validator.

Parameters

array $paths The paths to the mapping files.

Return Value

ValidatorBuilderInterface The builder object.

at line line 138
ValidatorBuilderInterface addYamlMapping(string $path)

Adds a YAML constraint mapping file to the validator.

Parameters

string $path The path to the mapping file.

Return Value

ValidatorBuilderInterface The builder object.

at line line 152
ValidatorBuilderInterface addYamlMappings(array $paths)

Adds a list of YAML constraint mappings file to the validator.

Parameters

array $paths The paths to the mapping files.

Return Value

ValidatorBuilderInterface The builder object.

at line line 166
ValidatorBuilderInterface addMethodMapping(string $methodName)

Enables constraint mapping using the given static method.

Parameters

string $methodName The name of the method.

Return Value

ValidatorBuilderInterface The builder object.

at line line 180
ValidatorBuilderInterface addMethodMappings(array $methodNames)

Enables constraint mapping using the given static methods.

Parameters

array $methodNames The names of the methods.

Return Value

ValidatorBuilderInterface The builder object.

at line line 194
ValidatorBuilderInterface enableAnnotationMapping(Reader $annotationReader = null)

Enables annotation based constraint mapping.

Parameters

Reader $annotationReader The annotation reader to be used.

Return Value

ValidatorBuilderInterface The builder object.

at line line 216
ValidatorBuilderInterface disableAnnotationMapping()

Disables annotation based constraint mapping.

Return Value

ValidatorBuilderInterface The builder object.

at line line 226
ValidatorBuilderInterface setMetadataFactory(MetadataFactoryInterface $metadataFactory)

Sets the class metadata factory used by the validator.

Parameters

MetadataFactoryInterface $metadataFactory The metadata factory.

Return Value

ValidatorBuilderInterface The builder object.

at line line 240
ValidatorBuilderInterface setMetadataCache(CacheInterface $cache)

Sets the cache for caching class metadata.

Parameters

CacheInterface $cache The cache instance.

Return Value

ValidatorBuilderInterface The builder object.

at line line 254
ValidatorBuilderInterface setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory)

Sets the constraint validator factory used by the validator.

Parameters

ConstraintValidatorFactoryInterface $validatorFactory The validator factory.

Return Value

ValidatorBuilderInterface The builder object.

at line line 264
ValidatorBuilderInterface setTranslator(TranslatorInterface $translator)

Sets the translator used for translating violation messages.

Parameters

TranslatorInterface $translator The translator instance.

Return Value

ValidatorBuilderInterface The builder object.

at line line 274
ValidatorBuilderInterface setTranslationDomain(string $translationDomain)

Sets the default translation domain of violation messages.

The same message can have different translations in different domains. Pass the domain that is used for violation messages by default to this method.

Parameters

string $translationDomain The translation domain of the violation messages.

Return Value

ValidatorBuilderInterface The builder object.

at line line 284
ValidatorInterface getValidator()

Builds and returns a new validator object.

Return Value

ValidatorInterface The built validator.