13
13
14
14
use Symfony \Component \Validator \Constraints \GroupSequence ;
15
15
use Symfony \Component \Validator \ConstraintViolationListInterface ;
16
+ use Symfony \Component \Validator \ExecutionContextInterface as LegacyExecutionContextInterface ;
16
17
use Symfony \Component \Validator \Mapping \MetadataInterface ;
17
18
use Symfony \Component \Validator \Validator \ValidatorInterface ;
18
19
use Symfony \Component \Validator \Violation \ConstraintViolationBuilderInterface ;
59
60
* @since 2.5
60
61
* @author Bernhard Schussek <[email protected] >
61
62
*/
62
- interface ExecutionContextInterface
63
+ interface ExecutionContextInterface extends LegacyExecutionContextInterface
63
64
{
64
- /**
65
- * Adds a violation at the current node of the validation graph.
66
- *
67
- * @param string $message The error message
68
- * @param array $parameters The parameters substituted in the error message
69
- */
70
- public function addViolation ($ message , array $ parameters = array ());
71
-
72
65
/**
73
66
* Returns a builder for adding a violation with extended information.
74
67
*
@@ -88,13 +81,6 @@ public function addViolation($message, array $parameters = array());
88
81
*/
89
82
public function buildViolation ($ message , array $ parameters = array ());
90
83
91
- /**
92
- * Returns the violations generated in this context.
93
- *
94
- * @return ConstraintViolationListInterface The constraint violations
95
- */
96
- public function getViolations ();
97
-
98
84
/**
99
85
* Returns the validator.
100
86
*
@@ -114,108 +100,4 @@ public function getViolations();
114
100
* @return ValidatorInterface
115
101
*/
116
102
public function getValidator ();
117
-
118
- /**
119
- * Returns the root value of the object graph.
120
- *
121
- * The validator, when given an object, traverses the properties and
122
- * related objects and their properties. The root of the validation is the
123
- * object at which the traversal started.
124
- *
125
- * The current value is returned by {@link getValue()}.
126
- *
127
- * @return mixed|null The root value of the validation or null, if no value
128
- * is currently being validated
129
- */
130
- public function getRoot ();
131
-
132
- /**
133
- * Returns the value that the validator is currently validating.
134
- *
135
- * If you want to retrieve the object that was originally passed to the
136
- * validator, use {@link getRoot()}.
137
- *
138
- * @return mixed|null The currently validated value or null, if no value is
139
- * currently being validated
140
- */
141
- public function getValue ();
142
-
143
- /**
144
- * Returns the metadata for the currently validated value.
145
- *
146
- * With the core implementation, this method returns a
147
- * {@link Mapping\ClassMetadata} instance if the current value is an object,
148
- * a {@link Mapping\PropertyMetadata} instance if the current value is
149
- * the value of a property and a {@link Mapping\GetterMetadata} instance if
150
- * the validated value is the result of a getter method. The metadata can
151
- * also be an {@link Mapping\GenericMetadata} if the current value does not
152
- * belong to any structural element.
153
- *
154
- * @return MetadataInterface|null The metadata of the currently validated
155
- * value or null, if no value is currently
156
- * being validated
157
- */
158
- public function getMetadata ();
159
-
160
- /**
161
- * Returns the validation group that is currently being validated.
162
- *
163
- * @return string|GroupSequence|null The current validation group or null,
164
- * if no value is currently being
165
- * validated
166
- */
167
- public function getGroup ();
168
-
169
- /**
170
- * Returns the class name of the current node.
171
- *
172
- * If the metadata of the current node does not implement
173
- * {@link ClassBasedInterface}, this method returns null.
174
- *
175
- * @return string|null The class name or null, if no class name could be
176
- * found
177
- */
178
- public function getClassName ();
179
-
180
- /**
181
- * Returns the property name of the current node.
182
- *
183
- * If the metadata of the current node does not implement
184
- * {@link PropertyMetadataInterface}, this method returns null.
185
- *
186
- * @return string|null The property name or null, if no property name could
187
- * be found
188
- */
189
- public function getPropertyName ();
190
-
191
- /**
192
- * Returns the property path to the value that the validator is currently
193
- * validating.
194
- *
195
- * For example, take the following object graph:
196
- *
197
- * (Person)---($address: Address)---($street: string)
198
- *
199
- * When the <tt>Person</tt> instance is passed to the validator, the
200
- * property path is initially empty. When the <tt>$address</tt> property
201
- * of that person is validated, the property path is "address". When
202
- * the <tt>$street</tt> property of the related <tt>Address</tt> instance
203
- * is validated, the property path is "address.street".
204
- *
205
- * Properties of objects are prefixed with a dot in the property path.
206
- * Indices of arrays or objects implementing the {@link \ArrayAccess}
207
- * interface are enclosed in brackets. For example, if the property in
208
- * the previous example is <tt>$addresses</tt> and contains an array
209
- * of <tt>Address</tt> instances, the property path generated for the
210
- * <tt>$street</tt> property of one of these addresses is for example
211
- * "addresses[0].street".
212
- *
213
- * @param string $subPath Optional. The suffix appended to the current
214
- * property path
215
- *
216
- * @return string The current property path. The result may be an empty
217
- * string if the validator is currently validating the
218
- * root value of the validation graph
219
- */
220
- public function getPropertyPath ($ subPath = '' );
221
103
}
0 commit comments