From 0be602deefc0dfd1fb802a8fa57e6edfa18efe3d Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Wed, 11 Jul 2012 11:42:36 +0200 Subject: [PATCH] [Validator] Deprecated the Size constraint --- UPGRADE-2.1.md | 20 +++++++++++++++++++ src/Symfony/Component/Validator/CHANGELOG.md | 1 + .../Component/Validator/Constraints/Size.php | 2 ++ .../Validator/Constraints/SizeValidator.php | 2 ++ 4 files changed, 25 insertions(+) diff --git a/UPGRADE-2.1.md b/UPGRADE-2.1.md index 2e396624f3..ef8756ab0a 100644 --- a/UPGRADE-2.1.md +++ b/UPGRADE-2.1.md @@ -1136,6 +1136,26 @@ private $recursiveCollection; ``` + * The `Size` constraint was deprecated and will be removed in Symfony 2.3. You should + use the constraints `Min` and `Max` instead. + + Before: + + ``` + /** @Assert\Size(min = 2, max = 16) */ + private $numberOfCpus; + ``` + + After: + + ``` + /** + * @Assert\Min(2) + * @Assert\Max(16) + */ + private $numberOfCpus; + ``` + ### Session * Flash messages now return an array based on their type. The old method is diff --git a/src/Symfony/Component/Validator/CHANGELOG.md b/src/Symfony/Component/Validator/CHANGELOG.md index 3d60fb5703..a1fd056d12 100644 --- a/src/Symfony/Component/Validator/CHANGELOG.md +++ b/src/Symfony/Component/Validator/CHANGELOG.md @@ -22,3 +22,4 @@ CHANGELOG recursively anymore by default. `Valid` contains a new property `deep` which enables the BC behavior. * added MinCount and MaxCount constraint + * deprecated the Size constraint diff --git a/src/Symfony/Component/Validator/Constraints/Size.php b/src/Symfony/Component/Validator/Constraints/Size.php index d350c78052..b72633eef2 100644 --- a/src/Symfony/Component/Validator/Constraints/Size.php +++ b/src/Symfony/Component/Validator/Constraints/Size.php @@ -17,6 +17,8 @@ use Symfony\Component\Validator\Constraint; * @Annotation * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ class Size extends Constraint { diff --git a/src/Symfony/Component/Validator/Constraints/SizeValidator.php b/src/Symfony/Component/Validator/Constraints/SizeValidator.php index 7ccbed737c..f26a0ec7d9 100644 --- a/src/Symfony/Component/Validator/Constraints/SizeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/SizeValidator.php @@ -18,6 +18,8 @@ use Symfony\Component\Validator\ConstraintValidator; * @author Bernhard Schussek * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ class SizeValidator extends ConstraintValidator {