Ejemplo n.º 1
0
 /**
  * Finds and displays a News entity.
  *
  */
 public function showAction(News $news)
 {
     parent::initFrontEnd();
     $em = $this->getDoctrine()->getManager();
     $CurrentNews = $em->getRepository('WellnessCoreBundle:News')->find($news->getId());
     if (!$CurrentNews) {
         throw $this->createNotFoundException('Unable to find News entity.');
     }
     return $this->render('WellnessCoreBundle:FrontEnd/News:show.html.twig', array('listImagesSlider' => $this->getListImageSlider(), 'listCategoryWithLogo' => $this->getListCategoryWithLogo(), 'CurrentNews' => $CurrentNews));
 }
Ejemplo n.º 2
0
 public function updateAction(Request $request, News $news)
 {
     $em = $this->getDoctrine()->getManager();
     $entity = $em->getRepository('WellnessCoreBundle:News')->find($news->getId());
     if (!$entity) {
         throw $this->createNotFoundException('Unable to find News entity.');
     }
     $deleteForm = $this->createDeleteForm($news->getId());
     $editForm = $this->createEditForm($entity);
     $editForm->handleRequest($request);
     if ($editForm->isValid()) {
         $em->flush();
         return $this->redirect($this->generateUrl('admin_news'));
     }
     return $this->render('WellnessCoreBundle:BackEnd/News:edit.html.twig', array('entity' => $entity, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView()));
 }