/** * Delete an Ort entity */ public function deleteAction() { if ($this->request->hasArgument('uUID')) { $uuid = $this->request->getArgument('uUID'); } if (empty($uuid)) { $this->throwStatus(400, 'Required uUID not provided', null); } $klosterstandorte = count($this->klosterstandortRepository->findByOrt($uuid)); $orthasurls = count($this->ortHasUrlRepository->findByOrt($uuid)); $bistums = count($this->bistumRepository->findByOrt($uuid)); if ($klosterstandorte == 0 && $orthasurls == 0 && $bistums == 0) { $ortObj = $this->ortRepository->findByIdentifier($uuid); if (!is_object($ortObj)) { $this->throwStatus(400, 'Entity Ort not available', null); } $this->ortRepository->remove($ortObj); // Fetch Ort Urls $ortHasUrls = $ortObj->getOrtHasUrls(); if (is_array($ortHasUrls)) { foreach ($ortHasUrls as $ortHasUrl) { $this->ortHasUrlRepository->remove($ortHasUrl); } } $this->throwStatus(200, null, null); } else { $this->throwStatus(400, 'Due to dependencies Ort entity could not be deleted', null); } }