From 708c7802135aa88e6f66223fbe45fc6d36186ce1 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Sun, 2 Jan 2011 19:19:15 +0100 Subject: [PATCH] [Validator] Renamed @Validation constraint to @Set --- .../Validator/Constraints/{Validation.php => Set.php} | 2 +- .../Validator/Mapping/Loader/AnnotationLoader.php | 8 ++++---- .../Symfony/Tests/Component/Validator/Fixtures/Entity.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename src/Symfony/Component/Validator/Constraints/{Validation.php => Set.php} (96%) diff --git a/src/Symfony/Component/Validator/Constraints/Validation.php b/src/Symfony/Component/Validator/Constraints/Set.php similarity index 96% rename from src/Symfony/Component/Validator/Constraints/Validation.php rename to src/Symfony/Component/Validator/Constraints/Set.php index 08b027f05219..ea939c0686be 100644 --- a/src/Symfony/Component/Validator/Constraints/Validation.php +++ b/src/Symfony/Component/Validator/Constraints/Set.php @@ -11,7 +11,7 @@ * with this source code in the file LICENSE. */ -class Validation +class Set { public $constraints; diff --git a/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php index 8ae8d12be508..314730151b84 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php @@ -14,7 +14,7 @@ use Symfony\Component\Validator\Exception\MappingException; use Symfony\Component\Validator\Mapping\ClassMetadata; use Doctrine\Common\Annotations\AnnotationReader; -use Symfony\Component\Validator\Constraints\Validation; +use Symfony\Component\Validator\Constraints\Set; use Symfony\Component\Validator\Constraints\GroupSequence; use Symfony\Component\Validator\Constraint; @@ -46,7 +46,7 @@ public function loadClassMetadata(ClassMetadata $metadata) $loaded = false; foreach ($this->reader->getClassAnnotations($reflClass) as $constraint) { - if ($constraint instanceof Validation) { + if ($constraint instanceof Set) { foreach ($constraint->constraints as $constraint) { $metadata->addConstraint($constraint); } @@ -62,7 +62,7 @@ public function loadClassMetadata(ClassMetadata $metadata) foreach ($reflClass->getProperties() as $property) { if ($property->getDeclaringClass()->getName() == $className) { foreach ($this->reader->getPropertyAnnotations($property) as $constraint) { - if ($constraint instanceof Validation) { + if ($constraint instanceof Set) { foreach ($constraint->constraints as $constraint) { $metadata->addPropertyConstraint($property->getName(), $constraint); } @@ -81,7 +81,7 @@ public function loadClassMetadata(ClassMetadata $metadata) // TODO: clean this up $name = lcfirst(substr($method->getName(), 0, 3)=='get' ? substr($method->getName(), 3) : substr($method->getName(), 2)); - if ($constraint instanceof Validation) { + if ($constraint instanceof Set) { foreach ($constraint->constraints as $constraint) { $metadata->addGetterConstraint($name, $constraint); } diff --git a/tests/Symfony/Tests/Component/Validator/Fixtures/Entity.php b/tests/Symfony/Tests/Component/Validator/Fixtures/Entity.php index e3db13331b56..6bdb3a926e86 100644 --- a/tests/Symfony/Tests/Component/Validator/Fixtures/Entity.php +++ b/tests/Symfony/Tests/Component/Validator/Fixtures/Entity.php @@ -10,7 +10,7 @@ * @Symfony\Tests\Component\Validator\Fixtures\ConstraintA * @validation:Min(3) * @validation:Choice({"A", "B"}) - * @validation:Validation({ + * @validation:Set({ * @validation:All({@validation:NotNull, @validation:Min(3)}), * @validation:All(constraints={@validation:NotNull, @validation:Min(3)}) * })