class ValidatorBuilder implements ValidatorBuilderInterface

The default implementation of {@link ValidatorBuilderInterface}.

Traits

A trait to help implement TranslatorInterface and LocaleAwareInterface.

Methods

setLocale($locale)

{@inheritdoc}

getLocale()

{@inheritdoc}

trans($id, array $parameters = [], $domain = null, $locale = null)

{@inheritdoc}

$this
addObjectInitializer(ObjectInitializerInterface $initializer)

Adds an object initializer to the validator.

$this
addObjectInitializers(array $initializers)

Adds a list of object initializers to the validator.

$this
addXmlMapping(string $path)

Adds an XML constraint mapping file to the validator.

$this
addXmlMappings(array $paths)

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

$this
addYamlMapping(string $path)

Adds a YAML constraint mapping file to the validator.

$this
addYamlMappings(array $paths)

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

$this
addMethodMapping(string $methodName)

Enables constraint mapping using the given static method.

$this
addMethodMappings(array $methodNames)

Enables constraint mapping using the given static methods.

$this
enableAnnotationMapping(Reader $annotationReader = null)

Enables annotation based constraint mapping.

$this
disableAnnotationMapping()

Disables annotation based constraint mapping.

$this
setMetadataFactory(MetadataFactoryInterface $metadataFactory)

Sets the class metadata factory used by the validator.

$this
setMetadataCache(CacheInterface $cache)

Sets the cache for caching class metadata.

$this
setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory)

Sets the constraint validator factory used by the validator.

$this
setTranslator(TranslatorInterface $translator)

Sets the translator used for translating violation messages.

$this
setTranslationDomain(string $translationDomain)

Sets the default translation domain of violation messages.

$this
addLoader(LoaderInterface $loader)

No description

getLoaders()

No description

getValidator()

Builds and returns a new validator object.

Details

in TranslatorTrait at line 28
setLocale($locale)

{@inheritdoc}

Parameters

$locale

in TranslatorTrait at line 36
getLocale()

{@inheritdoc}

in TranslatorTrait at line 44
trans($id, array $parameters = [], $domain = null, $locale = null)

{@inheritdoc}

Parameters

$id
array $parameters
$domain
$locale

at line 85
$this addObjectInitializer(ObjectInitializerInterface $initializer)

Adds an object initializer to the validator.

Parameters

ObjectInitializerInterface $initializer

Return Value

$this

at line 95
$this addObjectInitializers(array $initializers)

Adds a list of object initializers to the validator.

Parameters

array $initializers

Return Value

$this

at line 105
$this addXmlMapping(string $path)

Adds an XML constraint mapping file to the validator.

Parameters

string $path The path to the mapping file

Return Value

$this

at line 119
$this 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

$this

at line 133
$this addYamlMapping(string $path)

Adds a YAML constraint mapping file to the validator.

Parameters

string $path The path to the mapping file

Return Value

$this

at line 147
$this 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

$this

at line 161
$this addMethodMapping(string $methodName)

Enables constraint mapping using the given static method.

Parameters

string $methodName The name of the method

Return Value

$this

at line 175
$this addMethodMappings(array $methodNames)

Enables constraint mapping using the given static methods.

Parameters

array $methodNames The names of the methods

Return Value

$this

at line 189
$this enableAnnotationMapping(Reader $annotationReader = null)

Enables annotation based constraint mapping.

Parameters

Reader $annotationReader

Return Value

$this

at line 211
$this disableAnnotationMapping()

Disables annotation based constraint mapping.

Return Value

$this

at line 221
$this setMetadataFactory(MetadataFactoryInterface $metadataFactory)

Sets the class metadata factory used by the validator.

Parameters

MetadataFactoryInterface $metadataFactory

Return Value

$this

at line 235
$this setMetadataCache(CacheInterface $cache)

Sets the cache for caching class metadata.

Parameters

CacheInterface $cache

Return Value

$this

at line 249
$this setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory)

Sets the constraint validator factory used by the validator.

Parameters

ConstraintValidatorFactoryInterface $validatorFactory

Return Value

$this

at line 259
$this setTranslator(TranslatorInterface $translator)

Sets the translator used for translating violation messages.

Parameters

TranslatorInterface $translator

Return Value

$this

at line 269
$this 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

$this

at line 279
$this addLoader(LoaderInterface $loader)

Parameters

LoaderInterface $loader

Return Value

$this

at line 289
LoaderInterface[] getLoaders()

Return Value

LoaderInterface[]

at line 315
ValidatorInterface getValidator()

Builds and returns a new validator object.

Return Value

ValidatorInterface The built validator