Esempio n. 1
0
 /**
  * Delete an Orden 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);
     }
     $klosterordens = count($this->klosterordenRepository->findByOrden($uuid));
     $ordenhasurls = count($this->ordenHasUrlRepository->findByOrden($uuid));
     if ($klosterordens == 0 && $ordenhasurls == 0) {
         $ordenObj = $this->ordenRepository->findByIdentifier($uuid);
         if (!is_object($ordenObj)) {
             $this->throwStatus(400, 'Entity Orden not available', null);
         }
         $this->ordenRepository->remove($ordenObj);
         // Fetch Orden Urls
         $ordenHasUrls = $ordenObj->getOrdenHasUrls();
         if (is_array($ordenHasUrls)) {
             foreach ($ordenHasUrls as $ordenHasUrl) {
                 $this->ordenHasUrlRepository->remove($ordenHasUrl);
             }
         }
         $this->throwStatus(200, null, null);
     } else {
         $this->throwStatus(400, 'Due to dependencies Orden entity could not be deleted', null);
     }
 }