I have the
class user
{
@manytomany
private $countries
}
and
class country {
@manytomany
private $user
}
Now when the new user is created then i want to add predefined list of countries to user
$countries = $em->getRepository(Country)->findBy(array('population'=>'2000'))
I want to know how can i add those all countries in user entity
Is it possible
$user->addCountry($countries)