public function delete($entity, $withoutFlush = self::FLUSH) { if (!$entity instanceof PageEntity && !$entity instanceof ExtendedPageEntity) { throw new InvalidArgumentException("Entity must be instance of 'CmsModule\\Content\\Entities\\PageEntity'. '" . get_class($entity) . "' given."); } return parent::delete($entity, $withoutFlush); }
/** * @param LanguageEntity $entity * @param bool $withoutFlush * @return mixed */ public function delete($entity, $withoutFlush = self::FLUSH) { // foreach ($entity->getPages() as $page) { // if (count($page->getLanguages()) == 1) { // throw new \Nette\InvalidArgumentException("Language '{$entity->name}' require some pages which have content only in this language."); // } // } $ret = parent::delete($entity, $withoutFlush); $this->generateConfig(); return $ret; }
/** ------------------------ Callbacks --------------------------------- */ public function tableDelete($action, $id, $redirect = TRUE) { if (is_array($id)) { foreach ($id as $item) { $this->tableDelete($action, $item, FALSE); } } else { $this->repository->delete($this->repository->find($id)); } if ($redirect) { if (!$this->presenter->isAjax()) { $this->redirect('this'); } $this->invalidateControl('table'); $this->presenter->payload->url = $this->link('this'); } }