Country
およびという名前のエンティティRegion
。
CountryRepository
およびという名前のリポジトリRegionRepository
。
Region
エンティティにデータを保存する方法は?
$em = $this->container->get('doctrine')->getEntityManager();
$countryId=$em->getRepository('LocationBundle:Country')->find(1));
$region=new Region(); //How to create Region Ojbect
$region->setCountryId($countryId);
$region->setName('abc');
$region->save();