Пример #1
0
 /**
  * Delete an Band 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);
     }
     $klosters = count($this->klosterRepository->findByBand($uuid));
     $bandhasurls = count($this->bandHasUrlRepository->findByOrt($uuid));
     if ($klosters == 0 && $bandhasurls == 0) {
         $bandObj = $this->bandRepository->findByIdentifier($uuid);
         if (!is_object($bandObj)) {
             $this->throwStatus(400, 'Entity Band not available', null);
         }
         $this->bandRepository->remove($bandObj);
         // Fetch Band Urls
         $bandHasUrls = $bandObj->getBandHasUrls();
         if (is_array($bandHasUrls)) {
             foreach ($bandHasUrls as $bandHasUrl) {
                 $this->bandHasUrlRepository->remove($bandHasUrl);
             }
         }
         $this->throwStatus(200, null, null);
     } else {
         $this->throwStatus(400, 'Due to dependencies Band entity could not be deleted', null);
     }
 }