[Validator][GroupSequence] fixed GroupSequence validation ignores PropertyMetadata of parent classes
This commit is contained in:
parent
6de4359e4b
commit
54a7eff868
@ -350,6 +350,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
|
||||
$member = clone $member;
|
||||
|
||||
foreach ($member->getConstraints() as $constraint) {
|
||||
$member->constraintsByGroup[$this->getDefaultGroup()][] = $constraint;
|
||||
$constraint->addImplicitGroupName($this->getDefaultGroup());
|
||||
}
|
||||
|
||||
|
@ -138,16 +138,33 @@ class ClassMetadataTest extends \PHPUnit_Framework_TestCase
|
||||
$this->metadata->mergeConstraints($parent);
|
||||
$this->metadata->addPropertyConstraint('firstName', new ConstraintA());
|
||||
|
||||
$constraints = array(
|
||||
new ConstraintA(array('groups' => array(
|
||||
$constraintA1 = new ConstraintA(array('groups' => array(
|
||||
'Default',
|
||||
'EntityParent',
|
||||
'Entity',
|
||||
))),
|
||||
new ConstraintA(array('groups' => array(
|
||||
)));
|
||||
$constraintA2 = new ConstraintA(array('groups' => array(
|
||||
'Default',
|
||||
'Entity',
|
||||
))),
|
||||
)));
|
||||
|
||||
$constraints = array(
|
||||
$constraintA1,
|
||||
$constraintA2,
|
||||
);
|
||||
|
||||
$constraintsByGroup = array(
|
||||
'Default' => array(
|
||||
$constraintA1,
|
||||
$constraintA2,
|
||||
),
|
||||
'EntityParent' => array(
|
||||
$constraintA1,
|
||||
),
|
||||
'Entity' => array(
|
||||
$constraintA1,
|
||||
$constraintA2,
|
||||
),
|
||||
);
|
||||
|
||||
$members = $this->metadata->getPropertyMetadata('firstName');
|
||||
@ -155,6 +172,7 @@ class ClassMetadataTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertCount(1, $members);
|
||||
$this->assertEquals(self::PARENTCLASS, $members[0]->getClassName());
|
||||
$this->assertEquals($constraints, $members[0]->getConstraints());
|
||||
$this->assertEquals($constraintsByGroup, $members[0]->constraintsByGroup);
|
||||
}
|
||||
|
||||
public function testMemberMetadatas()
|
||||
|
Reference in New Issue
Block a user