comparison vendor/symfony/validator/ValidatorBuilderInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 1fec387a4317
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
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 * @param ObjectInitializerInterface $initializer The initializer
31 *
32 * @return $this
33 */
34 public function addObjectInitializer(ObjectInitializerInterface $initializer);
35
36 /**
37 * Adds a list of object initializers to the validator.
38 *
39 * @param array $initializers The initializer
40 *
41 * @return $this
42 */
43 public function addObjectInitializers(array $initializers);
44
45 /**
46 * Adds an XML constraint mapping file to the validator.
47 *
48 * @param string $path The path to the mapping file
49 *
50 * @return $this
51 */
52 public function addXmlMapping($path);
53
54 /**
55 * Adds a list of XML constraint mapping files to the validator.
56 *
57 * @param array $paths The paths to the mapping files
58 *
59 * @return $this
60 */
61 public function addXmlMappings(array $paths);
62
63 /**
64 * Adds a YAML constraint mapping file to the validator.
65 *
66 * @param string $path The path to the mapping file
67 *
68 * @return $this
69 */
70 public function addYamlMapping($path);
71
72 /**
73 * Adds a list of YAML constraint mappings file to the validator.
74 *
75 * @param array $paths The paths to the mapping files
76 *
77 * @return $this
78 */
79 public function addYamlMappings(array $paths);
80
81 /**
82 * Enables constraint mapping using the given static method.
83 *
84 * @param string $methodName The name of the method
85 *
86 * @return $this
87 */
88 public function addMethodMapping($methodName);
89
90 /**
91 * Enables constraint mapping using the given static methods.
92 *
93 * @param array $methodNames The names of the methods
94 *
95 * @return $this
96 */
97 public function addMethodMappings(array $methodNames);
98
99 /**
100 * Enables annotation based constraint mapping.
101 *
102 * @param Reader $annotationReader The annotation reader to be used
103 *
104 * @return $this
105 */
106 public function enableAnnotationMapping(Reader $annotationReader = null);
107
108 /**
109 * Disables annotation based constraint mapping.
110 *
111 * @return $this
112 */
113 public function disableAnnotationMapping();
114
115 /**
116 * Sets the class metadata factory used by the validator.
117 *
118 * @param MetadataFactoryInterface $metadataFactory The metadata factory
119 *
120 * @return $this
121 */
122 public function setMetadataFactory(MetadataFactoryInterface $metadataFactory);
123
124 /**
125 * Sets the cache for caching class metadata.
126 *
127 * @param CacheInterface $cache The cache instance
128 *
129 * @return $this
130 */
131 public function setMetadataCache(CacheInterface $cache);
132
133 /**
134 * Sets the constraint validator factory used by the validator.
135 *
136 * @param ConstraintValidatorFactoryInterface $validatorFactory The validator factory
137 *
138 * @return $this
139 */
140 public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory);
141
142 /**
143 * Sets the translator used for translating violation messages.
144 *
145 * @param TranslatorInterface $translator The translator instance
146 *
147 * @return $this
148 */
149 public function setTranslator(TranslatorInterface $translator);
150
151 /**
152 * Sets the default translation domain of violation messages.
153 *
154 * The same message can have different translations in different domains.
155 * Pass the domain that is used for violation messages by default to this
156 * method.
157 *
158 * @param string $translationDomain The translation domain of the violation messages
159 *
160 * @return $this
161 */
162 public function setTranslationDomain($translationDomain);
163
164 /**
165 * Builds and returns a new validator object.
166 *
167 * @return ValidatorInterface The built validator
168 */
169 public function getValidator();
170 }