/** * @Route("/delete/{id}/") * @ParamConverter("get") * @Template() */ public function deleteAction(Request $request, Entry $entry) { if ($entry->getArticleId() !== null) { $publisherService = $this->container->get('newscoop_ingest_plugin.publisher'); $publisherService->remove($entry); } $em = $this->container->get('em'); $em->remove($entry); $em->flush(); $this->get('session')->getFlashBag()->add('notice', $this->container->get('translator')->trans('plugin.ingest.entries.removedsuccess')); return $this->redirect($this->generateUrl('newscoop_ingestplugin_entry_list')); }
/** * Get an article entity related to the given entry * * @param \Newscoop\IngestPluginBundle\Entity\Feed\Entry $entry * * @return \Newscoop\Entity\Article */ protected function getArticle(\Newscoop\IngestPluginBundle\Entity\Feed\Entry $entry) { if ($entry->getArticleId() === null) { return null; } $article = $this->em->getRepository('\\Newscoop\\Entity\\Article')->findOneByNumber($entry->getArticleId()); return $article; }