Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
class Validation | ||
class Set | ||
{ | ||
public $constraints; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
use Symfony\Component\Validator\Exception\MappingException; | ||
use Symfony\Component\Validator\Mapping\ClassMetadata; | ||
use Doctrine\Common\Annotations\AnnotationReader; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
beberlei
Contributor
|
||
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); | ||
} | ||
|
The Validator component should not rely on Doctrine API... Why don't copy the Annotation reader class from Doctrine in the Validator component ?