d7cd16836bf351e2283a3bda6716994f82af512f
[yaffs-website] / vendor / symfony / validator / ValidatorBuilderInterface.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Validator;
13
14 use Doctrine\Common\Annotations\Reader;
15 use Symfony\Component\Translation\TranslatorInterface;
16 use Symfony\Component\Validator\Mapping\Cache\CacheInterface;
17 use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
18 use Symfony\Component\Validator\Validator\ValidatorInterface;
19
20 /**
21  * A configurable builder for ValidatorInterface objects.
22  *
23  * @author Bernhard Schussek <bschussek@gmail.com>
24  */
25 interface ValidatorBuilderInterface
26 {
27     /**
28      * Adds an object initializer to the validator.
29      *
30      * @return $this
31      */
32     public function addObjectInitializer(ObjectInitializerInterface $initializer);
33
34     /**
35      * Adds a list of object initializers to the validator.
36      *
37      * @param ObjectInitializerInterface[] $initializers
38      *
39      * @return $this
40      */
41     public function addObjectInitializers(array $initializers);
42
43     /**
44      * Adds an XML constraint mapping file to the validator.
45      *
46      * @param string $path The path to the mapping file
47      *
48      * @return $this
49      */
50     public function addXmlMapping($path);
51
52     /**
53      * Adds a list of XML constraint mapping files to the validator.
54      *
55      * @param string[] $paths The paths to the mapping files
56      *
57      * @return $this
58      */
59     public function addXmlMappings(array $paths);
60
61     /**
62      * Adds a YAML constraint mapping file to the validator.
63      *
64      * @param string $path The path to the mapping file
65      *
66      * @return $this
67      */
68     public function addYamlMapping($path);
69
70     /**
71      * Adds a list of YAML constraint mappings file to the validator.
72      *
73      * @param string[] $paths The paths to the mapping files
74      *
75      * @return $this
76      */
77     public function addYamlMappings(array $paths);
78
79     /**
80      * Enables constraint mapping using the given static method.
81      *
82      * @param string $methodName The name of the method
83      *
84      * @return $this
85      */
86     public function addMethodMapping($methodName);
87
88     /**
89      * Enables constraint mapping using the given static methods.
90      *
91      * @param string[] $methodNames The names of the methods
92      *
93      * @return $this
94      */
95     public function addMethodMappings(array $methodNames);
96
97     /**
98      * Enables annotation based constraint mapping.
99      *
100      * @return $this
101      */
102     public function enableAnnotationMapping(Reader $annotationReader = null);
103
104     /**
105      * Disables annotation based constraint mapping.
106      *
107      * @return $this
108      */
109     public function disableAnnotationMapping();
110
111     /**
112      * Sets the class metadata factory used by the validator.
113      *
114      * @return $this
115      */
116     public function setMetadataFactory(MetadataFactoryInterface $metadataFactory);
117
118     /**
119      * Sets the cache for caching class metadata.
120      *
121      * @return $this
122      */
123     public function setMetadataCache(CacheInterface $cache);
124
125     /**
126      * Sets the constraint validator factory used by the validator.
127      *
128      * @return $this
129      */
130     public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory);
131
132     /**
133      * Sets the translator used for translating violation messages.
134      *
135      * @return $this
136      */
137     public function setTranslator(TranslatorInterface $translator);
138
139     /**
140      * Sets the default translation domain of violation messages.
141      *
142      * The same message can have different translations in different domains.
143      * Pass the domain that is used for violation messages by default to this
144      * method.
145      *
146      * @param string $translationDomain The translation domain of the violation messages
147      *
148      * @return $this
149      */
150     public function setTranslationDomain($translationDomain);
151
152     /**
153      * Builds and returns a new validator object.
154      *
155      * @return ValidatorInterface The built validator
156      */
157     public function getValidator();
158 }