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