/** * @param $tagID * @throws \Exception */ public function remove($tagID) { try { $this->em->beginTransaction(); /** @var Tag $tag */ $tag = $this->tagRepository->find($tagID); if ($tag === null) { $this->em->commit(); return; } $tagSearchUrl = $this->urlFacade->getUrl('Pages:Front:Search', 'tag', $tag->getId()); $this->em->remove($tag); $this->em->remove($tagSearchUrl); $this->em->flush(); $this->em->commit(); $this->onSuccessTagRemoval($tag, $tagID); } catch (\Exception $e) { $this->em->rollback(); $this->em->close(); throw $e; } }