I have two entities in my system: Person and Phone as the following code.
class Person
{
/**
* @ORM\\Id
* @ORM\\Colum
Do this:
First on your phone entity, declare the fields as "nullable" like this:
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $countryCode;
This will allow these fields to have a null value.
Then you need to declare a validator that will check if either none of the fields or all of them are filled
class Phone {
...
/**
* @Assert\True(message = "Phone must be empty of fill all fields")
*/
public function isPhoneOK()
{
// check if no field is null or all of them are
// return false if these conditions are not met
}