I'm trying to write a validation for a field(1) to be required if another field(3) is option 'a', and a different field(2) if 3 is 'b'. How would I go about doing that?
EDIT: It is for an Entity. I'll post a sample of what I'm trying.
/**
*@Assert\Collection(
*fields = { aName = @Assert\NotBlank(),
* aAmount = @Assert\NotBlank() }
*/
protected $1;
/**
*@Assert\Collection(
*fields = { bName = @Assert\NotBlank(),
* bAmount = @Assert\NotBlank() }
*/
protected $2;
/**
*@Assert\NotBlank()
*/
protected $3;
I need $1 to be required if $3 == 'a', and $2 if $3 =='b'.