To enable recursive checking on objects, you can simply use Constraint @Assert\Valid
Example
Say the person has a mandatory last name
class Person { protected $lastName; }
And you have a product that has a buyer ( Person )
class Product { protected $buyer; }
Having NotNull and Valid , every time you check the Product model, it checks that:
- This one has a buyer
- Buyer has
lastName
Touki source share