Skip to content

Commit 76d2774

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

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\NotNull;
1819
use Symfony\Component\Validator\Constraints\Traverse;
@@ -580,6 +581,7 @@ public function testAccessCurrentObject()
580581
$called = false;
581582
$entity = new Entity();
582583
$entity->firstName = 'Bernhard';
584+
$entity->data = array('firstName' => 'Bernhard');
583585

584586
$callback = function ($value, ExecutionContextInterface $context) use ($entity, &$called) {
585587
$called = true;
@@ -588,6 +590,7 @@ public function testAccessCurrentObject()
588590

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

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

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)