Skip to content

Commit 1082873

Browse files
Merge branch '3.3' into 3.4
* 3.3: PHP CS Fixer: clean up repo and adjust config use interface_exists instead of class_exists Dumper shouldn't use html format for phpdbg [Validator] Fix access to root object when using composite constraint
2 parents e48611f + 76d2774 commit 1082873

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Tests/Validator/AbstractTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Validator\Constraints\Callback;
1515
use Symfony\Component\Validator\Constraints\Collection;
16+
use Symfony\Component\Validator\Constraints\Expression;
1617
use Symfony\Component\Validator\Constraints\GroupSequence;
1718
use Symfony\Component\Validator\Constraints\NotBlank;
1819
use Symfony\Component\Validator\Constraints\NotNull;
@@ -581,6 +582,7 @@ public function testAccessCurrentObject()
581582
$called = false;
582583
$entity = new Entity();
583584
$entity->firstName = 'Bernhard';
585+
$entity->data = array('firstName' => 'Bernhard');
584586

585587
$callback = function ($value, ExecutionContextInterface $context) use ($entity, &$called) {
586588
$called = true;
@@ -589,6 +591,7 @@ public function testAccessCurrentObject()
589591

590592
$this->metadata->addConstraint(new Callback($callback));
591593
$this->metadata->addPropertyConstraint('firstName', new Callback($callback));
594+
$this->metadata->addPropertyConstraint('data', new Collection(array('firstName' => new Expression('value == this.firstName'))));
592595

593596
$this->validator->validate($entity);
594597

Validator/RecursiveContextualValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function validate($value, $constraints = null, $groups = null)
108108

109109
$this->validateGenericNode(
110110
$value,
111-
null,
111+
$previousObject,
112112
is_object($value) ? spl_object_hash($value) : null,
113113
$metadata,
114114
$this->defaultPropertyPath,

0 commit comments

Comments
 (0)