Drupal investigation

ValidatorBuilderInterface.php 5.2KB

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