Ejemplo n.º 1
0
 /**
  * Delete a given article.
  *
  * @param Article $article
  */
 public function delete(Article $article, BusinessPage $bep)
 {
     $this->entityManager->remove($bep);
     $article->setVisibleOnFront(0);
     $article->setDeletedAt(new \DateTime());
     //flush the modifications
     $this->entityManager->flush();
 }
Ejemplo n.º 2
0
 /**
  * Page delete.
  *
  * @param Article $article
  *
  * @return JsonResponse
  * @Route("/{id}/delete", name="victoire_core_article_delete")
  * @Template()
  * @ParamConverter("article", class="VictoireBlogBundle:Article")
  */
 public function deleteAction(Article $article)
 {
     $bep = $this->get('victoire_page.page_helper')->findPageByParameters(['templateId' => $article->getTemplate()->getId(), 'entityId' => $article->getId()]);
     $blogViewReference = $this->container->get('victoire_view_reference.repository')->getOneReferenceByParameters(['viewId' => $article->getBlog()->getId()]);
     $this->get('victoire_blog.manager.article')->delete($article, $bep);
     $message = $this->get('translator')->trans('victoire.blog.article.delete.success', [], 'victoire');
     $this->get('session')->getFlashBag()->add('success', $message);
     $response = ['success' => true, 'url' => $this->generateUrl('victoire_core_page_show', ['url' => $blogViewReference->getUrl()]), 'message' => $message];
     return new JsonResponse($response);
 }
Ejemplo n.º 3
0
 /**
  * Page delete
  *
  * @param Article $article
  *
  * @return JsonResponse
  * @Route("/{id}/delete", name="victoire_core_article_delete")
  * @Template()
  * @ParamConverter("article", class="VictoireBlogBundle:Article")
  */
 public function deleteAction(Article $article)
 {
     $bep = $this->get('victoire_page.page_helper')->findPageByParameters(array('patternId' => $article->getPattern()->getId(), 'entityId' => $article->getId()));
     $this->get('victoire_blog.manager.article')->delete($article, $bep);
     //redirect to the homepage
     $homepageUrl = $this->generateUrl('victoire_core_page_show', array('_locale' => $article->getBlog()->getLocale(), 'url' => $article->getBlog()->getUrl()));
     $message = $this->get('translator')->trans('victoire.blog.article.delete.success', array(), 'victoire');
     $this->get('session')->getFlashBag()->add('success', $message);
     $response = array('success' => true, 'url' => $homepageUrl, 'message' => $message);
     return new JsonResponse($response);
 }