public function addcandidatAction(Request $request)
 {
     if (false === $this->get('security.context')->isGranted('ROLE_USER') || $this->get('security.context')->isGranted('ROLE_ADMIN') || $this->get('security.context')->isGranted('ROLE_MANAGER')) {
         throw new AccessDeniedException();
     }
     $em = $this->getDoctrine()->getManager();
     $candidat = new Candidat();
     $utilisateur = $em->getRepository("UtilisateurBundle:Utilisateur")->findOneById($this->getUser());
     $candidat->setUtilisateur($utilisateur);
     $form = $this->createForm(new CandidatType(), $candidat);
     $form->handleRequest($request);
     if ($form->isValid()) {
         $add = $form->getData();
         try {
             $em->persist($add);
             //$candidat->uploadPhoto();
             $em->flush();
             $this->get('session')->getFlashBag()->add('notice', 'enregistré');
         } catch (\Exception $e) {
             $this->get('session')->getFlashBag()->add('erreur', 'erreur');
         }
     }
     return $this->render('CandidatBundle:Pages:addcandidat.html.twig', array('addcandidatform' => $form->createView()));
 }
 /**
  * {@inheritDoc}
  */
 public function removeUpload()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'removeUpload', array());
     return parent::removeUpload();
 }