Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 * This file is part of the Symfony package.
|
Chris@0
|
5 *
|
Chris@0
|
6 * (c) Fabien Potencier <fabien@symfony.com>
|
Chris@0
|
7 *
|
Chris@0
|
8 * For the full copyright and license information, please view the LICENSE
|
Chris@0
|
9 * file that was distributed with this source code.
|
Chris@0
|
10 */
|
Chris@0
|
11
|
Chris@0
|
12 namespace Symfony\Component\Validator\Violation;
|
Chris@0
|
13
|
Chris@0
|
14 /**
|
Chris@0
|
15 * Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface}
|
Chris@0
|
16 * objects.
|
Chris@0
|
17 *
|
Chris@0
|
18 * Use the various methods on this interface to configure the built violation.
|
Chris@0
|
19 * Finally, call {@link addViolation()} to add the violation to the current
|
Chris@0
|
20 * execution context.
|
Chris@0
|
21 *
|
Chris@0
|
22 * @author Bernhard Schussek <bschussek@gmail.com>
|
Chris@0
|
23 */
|
Chris@0
|
24 interface ConstraintViolationBuilderInterface
|
Chris@0
|
25 {
|
Chris@0
|
26 /**
|
Chris@0
|
27 * Stores the property path at which the violation should be generated.
|
Chris@0
|
28 *
|
Chris@0
|
29 * The passed path will be appended to the current property path of the
|
Chris@0
|
30 * execution context.
|
Chris@0
|
31 *
|
Chris@0
|
32 * @param string $path The property path
|
Chris@0
|
33 *
|
Chris@0
|
34 * @return $this
|
Chris@0
|
35 */
|
Chris@0
|
36 public function atPath($path);
|
Chris@0
|
37
|
Chris@0
|
38 /**
|
Chris@0
|
39 * Sets a parameter to be inserted into the violation message.
|
Chris@0
|
40 *
|
Chris@0
|
41 * @param string $key The name of the parameter
|
Chris@0
|
42 * @param string $value The value to be inserted in the parameter's place
|
Chris@0
|
43 *
|
Chris@0
|
44 * @return $this
|
Chris@0
|
45 */
|
Chris@0
|
46 public function setParameter($key, $value);
|
Chris@0
|
47
|
Chris@0
|
48 /**
|
Chris@0
|
49 * Sets all parameters to be inserted into the violation message.
|
Chris@0
|
50 *
|
Chris@0
|
51 * @param array $parameters An array with the parameter names as keys and
|
Chris@0
|
52 * the values to be inserted in their place as
|
Chris@0
|
53 * values
|
Chris@0
|
54 *
|
Chris@0
|
55 * @return $this
|
Chris@0
|
56 */
|
Chris@0
|
57 public function setParameters(array $parameters);
|
Chris@0
|
58
|
Chris@0
|
59 /**
|
Chris@0
|
60 * Sets the translation domain which should be used for translating the
|
Chris@0
|
61 * violation message.
|
Chris@0
|
62 *
|
Chris@0
|
63 * @param string $translationDomain The translation domain
|
Chris@0
|
64 *
|
Chris@0
|
65 * @return $this
|
Chris@0
|
66 *
|
Chris@0
|
67 * @see \Symfony\Component\Translation\TranslatorInterface
|
Chris@0
|
68 */
|
Chris@0
|
69 public function setTranslationDomain($translationDomain);
|
Chris@0
|
70
|
Chris@0
|
71 /**
|
Chris@0
|
72 * Sets the invalid value that caused this violation.
|
Chris@0
|
73 *
|
Chris@0
|
74 * @param mixed $invalidValue The invalid value
|
Chris@0
|
75 *
|
Chris@0
|
76 * @return $this
|
Chris@0
|
77 */
|
Chris@0
|
78 public function setInvalidValue($invalidValue);
|
Chris@0
|
79
|
Chris@0
|
80 /**
|
Chris@0
|
81 * Sets the number which determines how the plural form of the violation
|
Chris@0
|
82 * message is chosen when it is translated.
|
Chris@0
|
83 *
|
Chris@0
|
84 * @param int $number The number for determining the plural form
|
Chris@0
|
85 *
|
Chris@0
|
86 * @return $this
|
Chris@0
|
87 *
|
Chris@0
|
88 * @see \Symfony\Component\Translation\TranslatorInterface::transChoice()
|
Chris@0
|
89 */
|
Chris@0
|
90 public function setPlural($number);
|
Chris@0
|
91
|
Chris@0
|
92 /**
|
Chris@0
|
93 * Sets the violation code.
|
Chris@0
|
94 *
|
Chris@0
|
95 * @param string|null $code The violation code
|
Chris@0
|
96 *
|
Chris@0
|
97 * @return $this
|
Chris@0
|
98 */
|
Chris@0
|
99 public function setCode($code);
|
Chris@0
|
100
|
Chris@0
|
101 /**
|
Chris@0
|
102 * Sets the cause of the violation.
|
Chris@0
|
103 *
|
Chris@0
|
104 * @param mixed $cause The cause of the violation
|
Chris@0
|
105 *
|
Chris@0
|
106 * @return $this
|
Chris@0
|
107 */
|
Chris@0
|
108 public function setCause($cause);
|
Chris@0
|
109
|
Chris@0
|
110 /**
|
Chris@0
|
111 * Adds the violation to the current execution context.
|
Chris@0
|
112 */
|
Chris@0
|
113 public function addViolation();
|
Chris@0
|
114 }
|