/** * Update a list of Bistum entities */ public function updateListAction() { if ($this->request->hasArgument('data')) { $bistumlist = $this->request->getArgument('data'); } if (empty($bistumlist)) { $this->throwStatus(400, 'Required data arguemnts not provided', null); } foreach ($bistumlist as $uuid => $bistum) { if (isset($uuid) && !empty($uuid)) { $bistumObj = $this->bistumRepository->findByIdentifier($uuid); $bistumObj->setBistum($bistum['bistum']); $bistumObj->setKirchenprovinz($bistum['kirchenprovinz']); $bistumObj->setBemerkung($bistum['bemerkung']); if (isset($bistum['ist_erzbistum']) && !empty($bistum['ist_erzbistum'])) { $ist_erzbistum = $bistum['ist_erzbistum']; } else { $ist_erzbistum = 0; } $bistumObj->setIst_erzbistum($ist_erzbistum); $bistumObj->setShapefile($bistum['shapefile']); $ortUUID = $bistum['ort']; $ort = $this->ortRepository->findByIdentifier($ortUUID); $bistumObj->setOrt($ort); $this->bistumRepository->update($bistumObj); } else { $this->throwStatus(400, 'Required uUID not provided', null); } } $this->persistenceManager->persistAll(); $this->throwStatus(200, null, null); }
/** * Update a list of Ort entities */ public function updateListAction() { if ($this->request->hasArgument('data')) { $ortlist = $this->request->getArgument('data'); } if (empty($ortlist)) { $this->throwStatus(400, 'Required data arguemnts not provided', null); } foreach ($ortlist as $uuid => $ort) { if (isset($uuid) && !empty($uuid)) { $ortObj = $this->ortRepository->findByIdentifier($uuid); $ortObj->setOrt($ort['ort']); $ortObj->setGemeinde($ort['gemeinde']); $ortObj->setKreis($ort['kreis']); $ortObj->setBreite($ort['breite']); $ortObj->setLaenge($ort['laenge']); if (isset($ort['wuestung']) && !empty($ort['wuestung'])) { $wuestung = $ort['wuestung']; } else { $wuestung = 0; } $ortObj->setWuestung($wuestung); $bistumUUID = $ort['bistum']; $bistum = $this->bistumRepository->findByIdentifier($bistumUUID); $ortObj->setBistum($bistum); $this->ortRepository->update($ortObj); } else { $this->throwStatus(400, 'Required uUID not provided', null); } } $this->persistenceManager->persistAll(); $this->throwStatus(200, null, null); }
public function searchBistumAction() { if ($this->request->hasArgument('uUID')) { $uuid = $this->request->getArgument('uUID'); if (!empty($uuid)) { $ort = $this->ortRepository->findByIdentifier($uuid); if (is_object($ort)) { $bistumObj = $ort->getBistum(); if (is_object($bistumObj)) { $bistumUUID = $bistumObj->getUUID(); } } } if (!empty($bistumUUID)) { return $bistumUUID; } else { return ''; } } }
/** * Import Ort table into the FLOW domain_model tabel subugoe_germaniasacra_domain_model_ort * @return int */ public function importOrtAction() { if ($this->logger) { $start = microtime(true); } /** @var \Doctrine\DBAL\Connection $sqlConnection */ $sqlConnection = $this->entityManager->getConnection(); $tbl = 'subugoe_germaniasacra_domain_model_ort'; $sql = "ANALYZE LOCAL TABLE " . $tbl; $sqlConnection->executeUpdate($sql); $sqlConnection->close(); /** @var \Doctrine\DBAL\Connection $sqlConnection */ $sqlConnection = $this->entityManager->getConnection(); $tbl = 'subugoe_germaniasacra_domain_model_urltyp'; $sql = 'SELECT * FROM ' . $tbl . ' WHERE name = "Geonames"'; $urltyp = $sqlConnection->fetchAll($sql); if (count($urltyp) > 0) { $urltypUUID = $urltyp[0]['persistence_object_identifier']; } if (!isset($urltypUUID)) { $urlTypeName = "Geonames"; $urltypObject = new Urltyp(); $urltypObject->setName($urlTypeName); $this->urltypRepository->add($urltypObject); $this->persistenceManager->persistAll(); $urltypUUID = $urltypObject->getUUID(); } $sql = 'SELECT * FROM Ort ORDER BY ID ASC'; $orts = $sqlConnection->fetchAll($sql); if (isset($orts) and is_array($orts)) { $nOrt = 0; foreach ($orts as $ortvalue) { $uid = $ortvalue['ID']; $ort = $ortvalue['Ort']; $laenge = round($ortvalue['Laenge'], 5); $breite = round($ortvalue['Breite'], 5); $wuestung = $ortvalue['Wuestung']; $gemeinde = $ortvalue['Gemeinde']; $kreis = $ortvalue['Kreis']; $land = $ortvalue['Land']; $url = $ortvalue['GeoNameId']; $ortObject = new Ort(); $ortObject->setUid($uid); $ortObject->setOrt($ort); $ortObject->setLaenge($laenge); $ortObject->setBreite($breite); $ortObject->setWuestung($wuestung); $ortObject->setGemeinde($gemeinde); $ortObject->setKreis($kreis); $landObject = $this->landRepository->findOneByUid($land); if (is_object($landObject)) { $ortObject->setLand($landObject); } $this->ortRepository->add($ortObject); $this->persistenceManager->persistAll(); $ortUUID = $ortObject->getUUID(); if (isset($url) && !empty($url)) { $url = 'http://geonames.org/' . $url; $urlbemerkung = $ort . " " . $url; $urlObject = new Url(); $urlObject->setUrl($url); $urlObject->setBemerkung($urlbemerkung); $urltypObject = $this->urltypRepository->findByIdentifier($urltypUUID); $urlObject->setUrltyp($urltypObject); $this->urlRepository->add($urlObject); $this->persistenceManager->persistAll(); $urlUUID = $urlObject->getUUID(); $orthasurlObject = new Orthasurl(); $ortObject = $this->ortRepository->findByIdentifier($ortUUID); $orthasurlObject->setOrt($ortObject); $urlObject = $this->urlRepository->findByIdentifier($urlUUID); $orthasurlObject->setUrl($urlObject); $this->ortHasUrlRepository->add($orthasurlObject); $this->persistenceManager->persistAll(); } $nOrt++; } if ($this->logger) { $end = microtime(true); $time = number_format($end - $start, 2); $this->logger->log('Ort import completed in ' . round($time / 60, 2) . ' minutes.'); } return $nOrt; } }