W3cubDocs

/Symfony 3.0

Symfony\Component\Validator\ValidatorBuilderInterface

interface ValidatorBuilderInterface

A configurable builder for ValidatorInterface objects.

Methods

ValidatorBuilderInterface addObjectInitializer(ObjectInitializerInterface $initializer)

Adds an object initializer to the validator.

ValidatorBuilderInterface addObjectInitializers(array $initializers)

Adds a list of object initializers to the validator.

ValidatorBuilderInterface addXmlMapping(string $path)

Adds an XML constraint mapping file to the validator.

ValidatorBuilderInterface addXmlMappings(array $paths)

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

ValidatorBuilderInterface addYamlMapping(string $path)

Adds a YAML constraint mapping file to the validator.

ValidatorBuilderInterface addYamlMappings(array $paths)

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

ValidatorBuilderInterface addMethodMapping(string $methodName)

Enables constraint mapping using the given static method.

ValidatorBuilderInterface addMethodMappings(array $methodNames)

Enables constraint mapping using the given static methods.

ValidatorBuilderInterface enableAnnotationMapping(Reader $annotationReader = null)

Enables annotation based constraint mapping.

ValidatorBuilderInterface disableAnnotationMapping()

Disables annotation based constraint mapping.

ValidatorBuilderInterface setMetadataFactory(MetadataFactoryInterface $metadataFactory)

Sets the class metadata factory used by the validator.

ValidatorBuilderInterface setMetadataCache(CacheInterface $cache)

Sets the cache for caching class metadata.

ValidatorBuilderInterface setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory)

Sets the constraint validator factory used by the validator.

ValidatorBuilderInterface setTranslator(TranslatorInterface $translator)

Sets the translator used for translating violation messages.

ValidatorBuilderInterface setTranslationDomain(string $translationDomain)

Sets the default translation domain of violation messages.

ValidatorInterface getValidator()

Builds and returns a new validator object.

Details

public ValidatorBuilderInterface addObjectInitializer(ObjectInitializerInterface $initializer)

Adds an object initializer to the validator.

Parameters

ObjectInitializerInterface $initializer The initializer

Return Value

ValidatorBuilderInterface The builder object

public ValidatorBuilderInterface addObjectInitializers(array $initializers)

Adds a list of object initializers to the validator.

Parameters

array $initializers The initializer

Return Value

ValidatorBuilderInterface The builder object

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public ValidatorBuilderInterface disableAnnotationMapping()

Disables annotation based constraint mapping.

Return Value

ValidatorBuilderInterface The builder object

public 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

public ValidatorBuilderInterface setMetadataCache(CacheInterface $cache)

Sets the cache for caching class metadata.

Parameters

CacheInterface $cache The cache instance

Return Value

ValidatorBuilderInterface The builder object

public 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

public ValidatorBuilderInterface setTranslator(TranslatorInterface $translator)

Sets the translator used for translating violation messages.

Parameters

TranslatorInterface $translator The translator instance

Return Value

ValidatorBuilderInterface The builder object

public 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

public ValidatorInterface getValidator()

Builds and returns a new validator object.

Return Value

ValidatorInterface The built validator.

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Validator/ValidatorBuilderInterface.html