/**
  * Creates a new Comment entity.
  *
  */
 public function commentCreateAction($slug)
 {
     $translator = $this->get('translator');
     $em = $this->getDoctrine()->getManager();
     // get event
     $event = $em->getRepository('EventBundle:Event')->findOneBy(array('slug' => $slug));
     //findBySlug($slug);
     if (!$event) {
         throw $this->createNotFoundException($translator->trans('AdministrationBundle.notFound', array("%name%" => "Congrès")));
         //'Unable to find Type entity.');
     }
     // get user
     $user = $this->getUser();
     // get lang
     $lang = $this->get('request')->get('lang');
     if (!$lang) {
         $lang = "en";
     }
     // get comment
     $comment = $this->get('request')->get('comment');
     // add comment
     if ($comment) {
         $entity = new Comment();
         $entity->setEvent($event);
         $entity->setUser($user);
         $entity->setLang($lang);
         $entity->setComment($comment);
         $em->persist($entity);
         $em->flush();
     }
     // get all comments
     $comments = $em->getRepository('EventBundle:Comment')->getCommentsByEvent($event, $lang);
     $templating = $this->get('templating');
     $reponse = $templating->render('EventBundle:Congres:comments.html.twig', array('comments' => $comments));
     // return json
     return new Response($reponse);
 }