public function deleteEntry($id)
 {
     if (!is_numeric($id)) {
         throw new Exceptions\InvalidArgumentException("Argument id has to be type of numeric, '{$id}' given");
     }
     try {
         $db = $this->entryDao->find($id);
         if ($db !== null) {
             $this->invalidateEntityCache($db);
             $this->entryDao->delete($db);
             $this->onDelete($db);
         }
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
Beispiel #2
0
 public function deleteSportType($id)
 {
     if (!is_numeric($id)) {
         throw new Exceptions\InvalidArgumentException("Argument id has to be type of numeric");
     }
     try {
         $db = $this->sportTypeDao->find($id);
         if ($db !== null) {
             $this->onDelete(clone $db);
             $this->sportTypeDao->delete($db);
             $this->invalidateEntityCache($db);
         }
     } catch (DBALException $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DependencyException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
 /**
  * @param Brabijan\SeoComponents\Entity\Route $route
  */
 public function delete(Brabijan\SeoComponents\Entity\Route $route)
 {
     $target = $route->target;
     $isRouteOneWay = $route->oneWay;
     $this->routeDao->delete($route);
     if ($isRouteOneWay === FALSE) {
         $target = new Brabijan\SeoComponents\Router\Target($target->targetPresenter, $target->targetAction, $target->targetId);
         $currentRoute = $this->findCurrentRouteByTarget($target);
         if ($currentRoute) {
             $this->cleanTargetCache($target);
             $currentRoute->oneWay = FALSE;
             $this->routeDao->save($currentRoute);
         }
     }
 }
Beispiel #4
0
 public function deleteComment($id)
 {
     if (!is_numeric($id)) {
         throw new Exceptions\InvalidArgumentException("Argument id has to be type of numeric");
     }
     try {
         $cDb = $this->commentDao->find($id);
         if ($cDb !== null) {
             $this->commentDao->delete($cDb);
             $this->invalidateEntityCache($cDb);
             $this->onDelete($cDb);
         }
     } catch (\Exception $ex) {
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
Beispiel #5
0
 public function deleteEvent($id)
 {
     if (!is_numeric($id)) {
         throw new Exceptions\InvalidArgumentException("Argument id has to be type of numeric");
     }
     try {
         $dbE = $this->eventDao->find($id);
         if ($dbE !== null) {
             $this->eventDao->delete($dbE);
             $this->onDelete($dbE);
         }
     } catch (DBALException $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
Beispiel #6
0
 public function deletePosition($p)
 {
     if ($p == null) {
         throw new Exceptions\NullPointerException("Argument Position cannot be null");
     }
     try {
         $db = $this->positionDao->find($this->getMixId($p));
         if ($db !== null) {
             $this->positionDao->delete($db);
             $this->onDelete($db);
         }
         $this->invalidateEntityCache($db);
     } catch (\Exception $e) {
         $this->logError($e);
         throw new Exceptions\DataErrorException($e->getMessage(), $e->getCode(), $e->getPrevious());
     }
 }
Beispiel #7
0
 public function deleteArticle($id)
 {
     if (!is_numeric($id)) {
         throw new Exceptions\InvalidArgumentException("Argument id has to be type of numeric, '{$id}' given");
     }
     try {
         $db = $this->articleDao->find($id);
         if ($db !== NULL) {
             $identifier = $db->getPicture();
             $this->imageService->removeResource($identifier);
             $this->articleDao->delete($db);
             $this->onDelete($db);
         }
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
 public function deleteSeasonApplication($id)
 {
     if ($id === null) {
         throw new Exceptions\NullPointerException("Argument id cannot be null", 0);
     }
     if (!is_numeric($id)) {
         throw new Exeptions\InvalidArgumentException("Argument id has to be type of numeric, '{$id}' given", 1);
     }
     try {
         $appDb = $this->seasonApplicationDao->find($id);
         if ($appDb !== null) {
             $this->seasonApplicationDao->delete($appDb);
             $this->invalidateEntityCache($appDb);
             $this->onDelete(clone $appDb);
         }
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
Beispiel #9
0
 public function deletePayment($id)
 {
     if (!is_numeric($id)) {
         throw new Exceptions\InvalidArgumentException("Argument id has to be type of numeric");
     }
     try {
         $payment = $this->paymentDao->find($id, false);
         if ($payment !== null && $payment->getStatus() !== PaymentStatus::SENT) {
             $this->paymentDao->delete($payment);
             $this->invalidateEntityCache($payment);
             $this->onDelete($payment);
         }
     } catch (DBALException $ex) {
         $this->logWarning($ex);
         throw new Exceptions\DependencyException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
Beispiel #10
0
 public function deleteSportGroup($id)
 {
     if ($id == null) {
         throw new Exceptions\NullPointerException("Argument id cannot be null", 0);
     }
     if (!is_numeric($id)) {
         throw new Exceptions\InvalidArgumentException("Argument id has to be type of numeric, '{$id}' given", 1);
     }
     try {
         $db = $this->groupDao->find($id);
         if ($db !== null) {
             $this->groupDao->delete($db);
             $this->invalidateEntityCache($db);
             $this->onDelete(clone $db);
         }
     } catch (\Kdyby\Doctrine\DBALException $ex) {
         $this->logWarning($ex);
         throw new Exceptions\DataErrorException($ex->getMessage(), 1000, $ex);
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
Beispiel #11
0
 public function deleteUser($id)
 {
     if (!is_numeric($id)) {
         throw new Exceptions\InvalidArgumentException("Argument Id must be type of numeric, '{$id}' given", 1);
     }
     $this->entityManager->beginTransaction();
     try {
         $db = $this->getUser($id);
         if ($db !== null) {
             $imageId = $db->getWebProfile()->getPicture();
             $this->imageService->removeResource($imageId);
             $this->userDao->delete($db);
         } else {
             throw new EntityNotFoundException("User with id '{$id}' does not exist", 2);
         }
         $this->entityManager->commit();
         $this->onDelete($db);
     } catch (DBALException $ex) {
         throw new Exceptions\DependencyException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     } catch (\Exception $e) {
         throw new Exceptions\DataErrorException($e->getMessage(), $e->getCode(), $e->getPrevious());
     }
 }
Beispiel #12
0
 /**
  * @param $entity \Entity\Post
  * @param null $relations
  * @param bool $flush
  *
  * @Secure\Delete(allow="admin")
  */
 public function delete($entity, $relations = NULL, $flush = Kdyby\Persistence\ObjectDao::FLUSH)
 {
     $this->onDelete($entity->id);
     $this->dao->delete($entity, $relations, $flush);
 }
Beispiel #13
0
 /**
  * @param User $user
  */
 public function deleteUser(User $user)
 {
     $this->userDao->delete($user);
 }