Skip to content

Commit 63adb97

Browse files
committed
Revert "merged branch blogsh/dynamic_constraints (PR #3114)"
This reverts commit 6b9a355, reversing changes made to 811ead8.
1 parent 53b3c83 commit 63adb97

File tree

4 files changed

+0
-99
lines changed

4 files changed

+0
-99
lines changed

src/Symfony/Component/Validator/ConstraintProviderInterface.php

-27
This file was deleted.

src/Symfony/Component/Validator/Validator.php

-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Validator;
1313

1414
use Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface;
15-
use Symfony\Component\Validator\Mapping\ClassMetadata;
1615

1716
/**
1817
* The default implementation of the ValidatorInterface.
@@ -58,13 +57,6 @@ public function getMetadataFactory()
5857
public function validate($object, $groups = null)
5958
{
6059
$metadata = $this->metadataFactory->getClassMetadata(get_class($object));
61-
62-
if ($object instanceof ConstraintProviderInterface) {
63-
$dynamicMetadata = new ClassMetadata(get_class($object));
64-
$dynamicMetadata->mergeConstraints($metadata);
65-
$object->loadDynamicValidatorMetadata($dynamicMetadata);
66-
$metadata = $dynamicMetadata;
67-
}
6860

6961
$walk = function(GraphWalker $walker, $group) use ($metadata, $object) {
7062
return $walker->walkObject($metadata, $object, $group, '');

tests/Symfony/Tests/Component/Validator/Fixtures/DynamicConstraintsEntity.php

-30
This file was deleted.

tests/Symfony/Tests/Component/Validator/ValidatorTest.php

-34
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
require_once __DIR__.'/Fixtures/FailingConstraint.php';
1616
require_once __DIR__.'/Fixtures/FailingConstraintValidator.php';
1717
require_once __DIR__.'/Fixtures/FakeClassMetadataFactory.php';
18-
require_once __DIR__.'/Fixtures/DynamicConstraintsEntity.php';
1918

2019
use Symfony\Tests\Component\Validator\Fixtures\Entity;
2120
use Symfony\Tests\Component\Validator\Fixtures\FakeClassMetadataFactory;
2221
use Symfony\Tests\Component\Validator\Fixtures\FailingConstraint;
23-
use Symfony\Tests\Component\Validator\Fixtures\DynamicConstraintsEntity;
2422
use Symfony\Component\Validator\Validator;
2523
use Symfony\Component\Validator\ConstraintViolation;
2624
use Symfony\Component\Validator\ConstraintViolationList;
@@ -123,38 +121,6 @@ public function testValidate_multipleGroups()
123121

124122
$this->assertEquals($violations, $result);
125123
}
126-
127-
public function testValidate_constraintProvider()
128-
{
129-
$entity = new DynamicConstraintsEntity();
130-
$metadata = new ClassMetadata(get_class($entity));
131-
$this->factory->addClassMetadata($metadata);
132-
133-
$entity->setValidation(true);
134-
135-
$violations = new ConstraintViolationList();
136-
$violations->add(new ConstraintViolation(
137-
'',
138-
array(),
139-
$entity,
140-
'firstValue',
141-
''
142-
));
143-
$violations->add(new ConstraintViolation(
144-
'',
145-
array(),
146-
$entity,
147-
'secondValue',
148-
''
149-
));
150-
151-
$this->assertEquals($violations, $this->validator->validate($entity));
152-
153-
$entity->setValidation(false);
154-
155-
$violations = new ConstraintViolationList();
156-
$this->assertEquals($violations, $this->validator->validate($entity));
157-
}
158124

159125
public function testValidateProperty()
160126
{

0 commit comments

Comments
 (0)