4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Validator\Violation;
15 * Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface}
18 * Use the various methods on this interface to configure the built violation.
19 * Finally, call {@link addViolation()} to add the violation to the current
22 * @author Bernhard Schussek <bschussek@gmail.com>
24 interface ConstraintViolationBuilderInterface
27 * Stores the property path at which the violation should be generated.
29 * The passed path will be appended to the current property path of the
32 * @param string $path The property path
36 public function atPath($path);
39 * Sets a parameter to be inserted into the violation message.
41 * @param string $key The name of the parameter
42 * @param string $value The value to be inserted in the parameter's place
46 public function setParameter($key, $value);
49 * Sets all parameters to be inserted into the violation message.
51 * @param array $parameters An array with the parameter names as keys and
52 * the values to be inserted in their place as
57 public function setParameters(array $parameters);
60 * Sets the translation domain which should be used for translating the
63 * @param string $translationDomain The translation domain
67 * @see \Symfony\Component\Translation\TranslatorInterface
69 public function setTranslationDomain($translationDomain);
72 * Sets the invalid value that caused this violation.
74 * @param mixed $invalidValue The invalid value
78 public function setInvalidValue($invalidValue);
81 * Sets the number which determines how the plural form of the violation
82 * message is chosen when it is translated.
84 * @param int $number The number for determining the plural form
88 * @see \Symfony\Component\Translation\TranslatorInterface::transChoice()
90 public function setPlural($number);
93 * Sets the violation code.
95 * @param string|null $code The violation code
99 public function setCode($code);
102 * Sets the cause of the violation.
104 * @param mixed $cause The cause of the violation
108 public function setCause($cause);
111 * Adds the violation to the current execution context.
113 public function addViolation();