I need to cascade validation in symfony2 form unless for specified group.
here symfony team told that group option is not supported in Valid constraint https://github.com/symfony/symfony/issues/4893
How to do it ?
Details:
I have a User Entity has address property which is a foreign key to Address Entity. Also i have Entity called business having User as property and also Address property. I need to validate address for User but, without validating it When User is a property of Business...
Schema
Class Address {
...
}
Class User {
/**
* @Assert\Valid(groups={"user"})
*/
private $address;
}
Class Business {
/**
* @Assert\Valid(groups={"business"})
*/
private $user;
/**
* @Assert\Valid(groups={"business"})
*/
private $address;
}
So I need to validate The address inside User only for User Forms but not for Business.
Thank you