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\Violation; Chris@0: Chris@0: /** Chris@0: * Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface} Chris@0: * objects. Chris@0: * Chris@0: * Use the various methods on this interface to configure the built violation. Chris@0: * Finally, call {@link addViolation()} to add the violation to the current Chris@0: * execution context. Chris@0: * Chris@0: * @author Bernhard Schussek Chris@0: */ Chris@0: interface ConstraintViolationBuilderInterface Chris@0: { Chris@0: /** Chris@0: * Stores the property path at which the violation should be generated. Chris@0: * Chris@0: * The passed path will be appended to the current property path of the Chris@0: * execution context. Chris@0: * Chris@0: * @param string $path The property path Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function atPath($path); Chris@0: Chris@0: /** Chris@0: * Sets a parameter to be inserted into the violation message. Chris@0: * Chris@0: * @param string $key The name of the parameter Chris@0: * @param string $value The value to be inserted in the parameter's place Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setParameter($key, $value); Chris@0: Chris@0: /** Chris@0: * Sets all parameters to be inserted into the violation message. Chris@0: * Chris@0: * @param array $parameters An array with the parameter names as keys and Chris@0: * the values to be inserted in their place as Chris@0: * values Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setParameters(array $parameters); Chris@0: Chris@0: /** Chris@0: * Sets the translation domain which should be used for translating the Chris@0: * violation message. Chris@0: * Chris@0: * @param string $translationDomain The translation domain Chris@0: * Chris@0: * @return $this Chris@0: * Chris@0: * @see \Symfony\Component\Translation\TranslatorInterface Chris@0: */ Chris@0: public function setTranslationDomain($translationDomain); Chris@0: Chris@0: /** Chris@0: * Sets the invalid value that caused this violation. Chris@0: * Chris@0: * @param mixed $invalidValue The invalid value Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setInvalidValue($invalidValue); Chris@0: Chris@0: /** Chris@0: * Sets the number which determines how the plural form of the violation Chris@0: * message is chosen when it is translated. Chris@0: * Chris@0: * @param int $number The number for determining the plural form Chris@0: * Chris@0: * @return $this Chris@0: * Chris@0: * @see \Symfony\Component\Translation\TranslatorInterface::transChoice() Chris@0: */ Chris@0: public function setPlural($number); Chris@0: Chris@0: /** Chris@0: * Sets the violation code. Chris@0: * Chris@0: * @param string|null $code The violation code Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setCode($code); Chris@0: Chris@0: /** Chris@0: * Sets the cause of the violation. Chris@0: * Chris@0: * @param mixed $cause The cause of the violation Chris@0: * Chris@0: * @return $this Chris@0: */ Chris@0: public function setCause($cause); Chris@0: Chris@0: /** Chris@0: * Adds the violation to the current execution context. Chris@0: */ Chris@0: public function addViolation(); Chris@0: }