Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f523d9d

Browse files
committed
[Validator] removed deprecated methods
1 parent 34a258e commit f523d9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+205
-2404
lines changed

src/Symfony/Component/Validator/ConstraintValidator.php

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Validator;
1313

14-
use Symfony\Component\Validator\Context\ExecutionContextInterface as ExecutionContextInterface2Dot5;
14+
use Symfony\Component\Validator\Context\ExecutionContextInterface;
1515
use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;
1616
use Symfony\Component\Validator\Violation\LegacyConstraintViolationBuilder;
1717

@@ -50,51 +50,6 @@ public function initialize(ExecutionContextInterface $context)
5050
$this->context = $context;
5151
}
5252

53-
/**
54-
* Wrapper for {@link ExecutionContextInterface::buildViolation} that
55-
* supports the 2.4 context API.
56-
*
57-
* @param string $message The violation message
58-
* @param array $parameters The message parameters
59-
*
60-
* @return ConstraintViolationBuilderInterface The violation builder
61-
*
62-
* @deprecated since version 2.5, to be removed in 3.0.
63-
*/
64-
protected function buildViolation($message, array $parameters = array())
65-
{
66-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
67-
68-
if ($this->context instanceof ExecutionContextInterface2Dot5) {
69-
return $this->context->buildViolation($message, $parameters);
70-
}
71-
72-
return new LegacyConstraintViolationBuilder($this->context, $message, $parameters);
73-
}
74-
75-
/**
76-
* Wrapper for {@link ExecutionContextInterface::buildViolation} that
77-
* supports the 2.4 context API.
78-
*
79-
* @param ExecutionContextInterface $context The context to use
80-
* @param string $message The violation message
81-
* @param array $parameters The message parameters
82-
*
83-
* @return ConstraintViolationBuilderInterface The violation builder
84-
*
85-
* @deprecated since version 2.5, to be removed in 3.0.
86-
*/
87-
protected function buildViolationInContext(ExecutionContextInterface $context, $message, array $parameters = array())
88-
{
89-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
90-
91-
if ($context instanceof ExecutionContextInterface2Dot5) {
92-
return $context->buildViolation($message, $parameters);
93-
}
94-
95-
return new LegacyConstraintViolationBuilder($context, $message, $parameters);
96-
}
97-
9853
/**
9954
* Returns a string representation of the type of the value.
10055
*

src/Symfony/Component/Validator/ConstraintValidatorInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Validator;
1313

14+
use Symfony\Component\Validator\Context\ExecutionContextInterface;
15+
1416
/**
1517
* @author Bernhard Schussek <[email protected]>
1618
*/

src/Symfony/Component/Validator/ConstraintViolation.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,6 @@ public function getMessageTemplate()
141141

142142
/**
143143
* {@inheritdoc}
144-
*
145-
* @deprecated since version 2.7, to be removed in 3.0.
146-
* Use getParameters() instead
147-
*/
148-
public function getMessageParameters()
149-
{
150-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7, to be removed in 3.0. Use the ConstraintViolation::getParameters() method instead.', E_USER_DEPRECATED);
151-
152-
return $this->parameters;
153-
}
154-
155-
/**
156-
* Alias of {@link getMessageParameters()}.
157144
*/
158145
public function getParameters()
159146
{
@@ -162,19 +149,6 @@ public function getParameters()
162149

163150
/**
164151
* {@inheritdoc}
165-
*
166-
* @deprecated since version 2.7, to be removed in 3.0.
167-
* Use getPlural() instead
168-
*/
169-
public function getMessagePluralization()
170-
{
171-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7, to be removed in 3.0. Use the ConstraintViolation::getPlural() method instead.', E_USER_DEPRECATED);
172-
173-
return $this->plural;
174-
}
175-
176-
/**
177-
* Alias of {@link getMessagePluralization()}.
178152
*/
179153
public function getPlural()
180154
{

src/Symfony/Component/Validator/ConstraintViolationInterface.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getMessage();
4646
* Returns the raw violation message.
4747
*
4848
* The raw violation message contains placeholders for the parameters
49-
* returned by {@link getMessageParameters}. Typically you'll pass the
49+
* returned by {@link getParameters}. Typically you'll pass the
5050
* message template and parameters to a translation engine.
5151
*
5252
* @return string The raw violation message.
@@ -60,10 +60,8 @@ public function getMessageTemplate();
6060
* that appear in the message template.
6161
*
6262
* @see getMessageTemplate()
63-
*
64-
* @deprecated since version 2.7, to be replaced by getParameters() in 3.0.
6563
*/
66-
public function getMessageParameters();
64+
public function getParameters();
6765

6866
/**
6967
* Returns a number for pluralizing the violation message.
@@ -80,10 +78,8 @@ public function getMessageParameters();
8078
* pluralization form (in this case "choices").
8179
*
8280
* @return int|null The number to use to pluralize of the message.
83-
*
84-
* @deprecated since version 2.7, to be replaced by getPlural() in 3.0.
8581
*/
86-
public function getMessagePluralization();
82+
public function getPlural();
8783

8884
/**
8985
* Returns the root element of the validation.

src/Symfony/Component/Validator/Constraints/GroupSequence.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\Validator\Constraints;
1313

14-
use Symfony\Component\Validator\Exception\OutOfBoundsException;
15-
1614
/**
1715
* A sequence of validation groups.
1816
*

src/Symfony/Component/Validator/Context/ExecutionContextInterface.php

Lines changed: 111 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Validator\Context;
1313

1414
use Symfony\Component\Validator\Constraint;
15-
use Symfony\Component\Validator\ExecutionContextInterface as LegacyExecutionContextInterface;
1615
use Symfony\Component\Validator\Mapping\MetadataInterface;
1716
use Symfony\Component\Validator\Validator\ValidatorInterface;
1817
use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;
@@ -60,7 +59,7 @@
6059
*
6160
* @author Bernhard Schussek <[email protected]>
6261
*/
63-
interface ExecutionContextInterface extends LegacyExecutionContextInterface
62+
interface ExecutionContextInterface
6463
{
6564
/**
6665
* Returns a builder for adding a violation with extended information.
@@ -224,4 +223,114 @@ public function markObjectAsInitialized($cacheKey);
224223
* @see ObjectInitializerInterface
225224
*/
226225
public function isObjectInitialized($cacheKey);
226+
227+
/**
228+
* Returns the violations generated by the validator so far.
229+
*
230+
* @return ConstraintViolationListInterface The constraint violation list.
231+
*/
232+
public function getViolations();
233+
234+
/**
235+
* Returns the value at which validation was started in the object graph.
236+
*
237+
* The validator, when given an object, traverses the properties and
238+
* related objects and their properties. The root of the validation is the
239+
* object from which the traversal started.
240+
*
241+
* The current value is returned by {@link getValue}.
242+
*
243+
* @return mixed The root value of the validation.
244+
*/
245+
public function getRoot();
246+
247+
/**
248+
* Returns the value that the validator is currently validating.
249+
*
250+
* If you want to retrieve the object that was originally passed to the
251+
* validator, use {@link getRoot}.
252+
*
253+
* @return mixed The currently validated value.
254+
*/
255+
public function getValue();
256+
257+
/**
258+
* Returns the metadata for the currently validated value.
259+
*
260+
* With the core implementation, this method returns a
261+
* {@link Mapping\ClassMetadata} instance if the current value is an object,
262+
* a {@link Mapping\PropertyMetadata} instance if the current value is
263+
* the value of a property and a {@link Mapping\GetterMetadata} instance if
264+
* the validated value is the result of a getter method.
265+
*
266+
* If the validated value is neither of these, for example if the validator
267+
* has been called with a plain value and constraint, this method returns
268+
* null.
269+
*
270+
* @return MetadataInterface|null The metadata of the currently validated
271+
* value.
272+
*/
273+
public function getMetadata();
274+
275+
/**
276+
* Returns the validation group that is currently being validated.
277+
*
278+
* @return string The current validation group.
279+
*/
280+
public function getGroup();
281+
282+
/**
283+
* Returns the class name of the current node.
284+
*
285+
* If the metadata of the current node does not implement
286+
* {@link ClassBasedInterface} or if no metadata is available for the
287+
* current node, this method returns null.
288+
*
289+
* @return string|null The class name or null, if no class name could be found.
290+
*/
291+
public function getClassName();
292+
293+
/**
294+
* Returns the property name of the current node.
295+
*
296+
* If the metadata of the current node does not implement
297+
* {@link PropertyMetadataInterface} or if no metadata is available for the
298+
* current node, this method returns null.
299+
*
300+
* @return string|null The property name or null, if no property name could be found.
301+
*/
302+
public function getPropertyName();
303+
304+
/**
305+
* Returns the property path to the value that the validator is currently
306+
* validating.
307+
*
308+
* For example, take the following object graph:
309+
*
310+
* <pre>
311+
* (Person)---($address: Address)---($street: string)
312+
* </pre>
313+
*
314+
* When the <tt>Person</tt> instance is passed to the validator, the
315+
* property path is initially empty. When the <tt>$address</tt> property
316+
* of that person is validated, the property path is "address". When
317+
* the <tt>$street</tt> property of the related <tt>Address</tt> instance
318+
* is validated, the property path is "address.street".
319+
*
320+
* Properties of objects are prefixed with a dot in the property path.
321+
* Indices of arrays or objects implementing the {@link \ArrayAccess}
322+
* interface are enclosed in brackets. For example, if the property in
323+
* the previous example is <tt>$addresses</tt> and contains an array
324+
* of <tt>Address</tt> instance, the property path generated for the
325+
* <tt>$street</tt> property of one of these addresses is for example
326+
* "addresses[0].street".
327+
*
328+
* @param string $subPath Optional. The suffix appended to the current
329+
* property path.
330+
*
331+
* @return string The current property path. The result may be an empty
332+
* string if the validator is currently validating the
333+
* root value of the validation graph.
334+
*/
335+
public function getPropertyPath($subPath = '');
227336
}

src/Symfony/Component/Validator/Context/LegacyExecutionContext.php

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)