1313
1414use Symfony \Component \Validator \Constraints \GroupSequence ;
1515use Symfony \Component \Validator \ConstraintViolationListInterface ;
16+ use Symfony \Component \Validator \ExecutionContextInterface as LegacyExecutionContextInterface ;
1617use Symfony \Component \Validator \Mapping \MetadataInterface ;
1718use Symfony \Component \Validator \Validator \ValidatorInterface ;
1819use Symfony \Component \Validator \Violation \ConstraintViolationBuilderInterface ;
5960 * @since 2.5
6061 * @author Bernhard Schussek <[email protected] > 6162 */
62- interface ExecutionContextInterface
63+ interface ExecutionContextInterface extends LegacyExecutionContextInterface
6364{
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-
7265 /**
7366 * Returns a builder for adding a violation with extended information.
7467 *
@@ -88,13 +81,6 @@ public function addViolation($message, array $parameters = array());
8881 */
8982 public function buildViolation ($ message , array $ parameters = array ());
9083
91- /**
92- * Returns the violations generated in this context.
93- *
94- * @return ConstraintViolationListInterface The constraint violations
95- */
96- public function getViolations ();
97-
9884 /**
9985 * Returns the validator.
10086 *
@@ -114,108 +100,4 @@ public function getViolations();
114100 * @return ValidatorInterface
115101 */
116102 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 = '' );
221103}
0 commit comments