Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Validator; Chris@0: Chris@0: use Doctrine\Common\Annotations\Reader; Chris@0: use Symfony\Component\Translation\TranslatorInterface; Chris@0: use Symfony\Component\Validator\Mapping\Cache\CacheInterface; Chris@0: use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; Chris@0: use Symfony\Component\Validator\Validator\ValidatorInterface; Chris@0: Chris@0: /** Chris@0: * A configurable builder for ValidatorInterface objects. Chris@0: * Chris@0: * @author Bernhard Schussek Chris@0: */ Chris@0: interface ValidatorBuilderInterface Chris@0: { Chris@0: /** Chris@0: * Adds an object initializer to the validator. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function addObjectInitializer(ObjectInitializerInterface $initializer); Chris@0: Chris@0: /** Chris@0: * Adds a list of object initializers to the validator. Chris@0: * Chris@14: * @param ObjectInitializerInterface[] $initializers Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function addObjectInitializers(array $initializers); Chris@0: Chris@0: /** Chris@0: * Adds an XML constraint mapping file to the validator. Chris@0: * Chris@0: * @param string $path The path to the mapping file Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function addXmlMapping($path); Chris@0: Chris@0: /** Chris@0: * Adds a list of XML constraint mapping files to the validator. Chris@0: * Chris@14: * @param string[] $paths The paths to the mapping files Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function addXmlMappings(array $paths); Chris@0: Chris@0: /** Chris@0: * Adds a YAML constraint mapping file to the validator. Chris@0: * Chris@0: * @param string $path The path to the mapping file Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function addYamlMapping($path); Chris@0: Chris@0: /** Chris@0: * Adds a list of YAML constraint mappings file to the validator. Chris@0: * Chris@14: * @param string[] $paths The paths to the mapping files Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function addYamlMappings(array $paths); Chris@0: Chris@0: /** Chris@0: * Enables constraint mapping using the given static method. Chris@0: * Chris@0: * @param string $methodName The name of the method Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function addMethodMapping($methodName); Chris@0: Chris@0: /** Chris@0: * Enables constraint mapping using the given static methods. Chris@0: * Chris@14: * @param string[] $methodNames The names of the methods Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function addMethodMappings(array $methodNames); Chris@0: Chris@0: /** Chris@0: * Enables annotation based constraint mapping. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function enableAnnotationMapping(Reader $annotationReader = null); Chris@0: Chris@0: /** Chris@0: * Disables annotation based constraint mapping. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function disableAnnotationMapping(); Chris@0: Chris@0: /** Chris@0: * Sets the class metadata factory used by the validator. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setMetadataFactory(MetadataFactoryInterface $metadataFactory); Chris@0: Chris@0: /** Chris@0: * Sets the cache for caching class metadata. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setMetadataCache(CacheInterface $cache); Chris@0: Chris@0: /** Chris@0: * Sets the constraint validator factory used by the validator. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory); Chris@0: Chris@0: /** Chris@0: * Sets the translator used for translating violation messages. Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setTranslator(TranslatorInterface $translator); Chris@0: Chris@0: /** Chris@0: * Sets the default translation domain of violation messages. Chris@0: * Chris@0: * The same message can have different translations in different domains. Chris@0: * Pass the domain that is used for violation messages by default to this Chris@0: * method. Chris@0: * Chris@0: * @param string $translationDomain The translation domain of the violation messages Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setTranslationDomain($translationDomain); Chris@0: Chris@0: /** Chris@0: * Builds and returns a new validator object. Chris@0: * Chris@0: * @return ValidatorInterface The built validator Chris@0: */ Chris@0: public function getValidator(); Chris@0: }