Closed
Description
GroupSequences do not seem to run property validations of parent classes. Class constraints are recognized correctly and run without problem but not those on the Parent::$property
's.
For example:
/**
* @Assert\ParentClassConstraint()
*/
class Parent
{
/**
* @Assert\NotNull()
*/
protected $property;
}
/**
* @Assert\ChildClassConstraint()
* @Assert\GroupSequence({"Child", "Extra"})
*/
class Child extends Parent
{
/**
* @Assert\NotNull(groups={"Extra"})
*/
private $anotherProperty;
}
When I run the validation on Child
the group sequence will run @Assert\ParentClassConstraint()
of Parent
, @Assert\ChildClassConstraint()
of Child
and @Assert\NotNull(groups={"Extra"})
of Child
. However, it will not run @Assert\NotNull()
of Parent
I think I found the cause of the problem: \Symfony\Component\Validator\Mapping\ClassMetadata::mergeConstraints
Does not seem to add them to the PropertyMetadata::$constraintsByGroup
.
I will create a patch with tests to see if i can suggest a fix.