/**
  * @return array
  * @View()
  */
 public function postAdvicesAction()
 {
     $request = $this->get('request');
     if ($request->getMethod() == 'POST') {
         $params = $request->request->all();
         $repository = $this->getDoctrine()->getManager()->getRepository('FreedomObjectiveBundle:Objective');
         $objective = $repository->find($params['idObjective']);
         //If objective is public or we have the rigth to see it then :
         $advice = new Advice();
         $advice->setName(htmlentities($params['message']));
         $advice->setObjective($objective);
         $advice->setUser($this->getUser());
         $em = $this->getDoctrine()->getManager();
         $em->persist($advice);
         $em->flush();
         //We choose what we want to return
         $repositoryAdvice = $this->getDoctrine()->getManager()->getRepository('FreedomObjectiveBundle:Advice');
         $adviceArray = $repositoryAdvice->myFindOne($advice->getId());
     }
     return $adviceArray;
 }