예제 #1
0
 /**
  * Create a new Land entity
  */
 public function createAction()
 {
     $landObj = new Land();
     if (is_object($landObj)) {
         if (!$this->request->hasArgument('land')) {
             $this->throwStatus(400, 'Land name not provided', null);
         }
         $landObj->setLand($this->request->getArgument('land'));
         $landObj->setIst_in_deutschland($this->request->hasArgument('ist_in_deutschland'));
         $this->landRepository->add($landObj);
         $this->persistenceManager->persistAll();
         $this->throwStatus(201, null, null);
     }
 }
 /**
  * Import Land table into the FLOW domain_model tabel subugoe_germaniasacra_domain_model_land
  * @return int
  */
 public function importLandAction()
 {
     /** @var \Doctrine\DBAL\Connection $sqlConnection */
     $sqlConnection = $this->entityManager->getConnection();
     $sql = 'SELECT ID_Bundesland, Land, Deutschland FROM Land';
     $Lands = $sqlConnection->fetchAll($sql);
     if (isset($Lands) and is_array($Lands)) {
         $nLand = 0;
         foreach ($Lands as $Land) {
             $uid = $Land['ID_Bundesland'];
             $land = $Land['Land'];
             $ist_in_deutschland = $Land['Deutschland'];
             $landObject = new Land();
             $landObject->setUid($uid);
             $landObject->setLand($land);
             $landObject->setIst_in_deutschland($ist_in_deutschland);
             $this->landRepository->add($landObject);
             $this->persistenceManager->persistAll();
             $nLand++;
         }
         return $nLand;
     }
 }