Exemplo n.º 1
0
 /**
  * Получаем id города
  *
  * @param City $city
  *
  * @return self
  */
 public function setCityId($city)
 {
     if ($city) {
         $this->cityId = $city->getId();
     }
     return $this;
 }
Exemplo n.º 2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $em = $this->getContainer()->get("doctrine.orm.entity_manager");
     $country = new Country();
     $country->setName("Россия");
     $em->persist($country);
     $em->flush();
     foreach ($this->citys as $name) {
         $role = new City();
         $role->setCountry($country);
         $role->setName($name);
         $em->persist($role);
     }
     $em->flush();
 }