0

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();
4

1 に答える 1