public function addcompetenceAction()
 {
     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();
     /*$c=new Candidat();
             $c=$em->getRepository("UtilisateurBundle:Candidat")->findOneByUtilisateur($this->getUser());
             
            $experience=new Experience();
     $nivexperience=new CandidatExperienceNiveau();
     
     
     $nivexperience->setIdExperience($experience);
     $nivexperience->setIdCandidat($c);
     $experience->getCandidatNE()->add($nivexperience);*/
     $c = new Candidat();
     $c = $em->getRepository("UtilisateurBundle:Candidat")->findOneByUtilisateur($this->getUser());
     if (!$c) {
         $this->get('session')->getFlashBag()->add('msgformation', 'formation');
         $router = $this->container->get('router');
         return $this->redirect($router->generate('candidat_affichercompetence'), 307);
     }
     $competence = new Competence();
     $competence->setIdCandidat($c);
     $form = $this->createForm(new CompetenceType(), $competence);
     $form->bind($this->getRequest());
     if ($form->isValid()) {
         try {
             $add = $form->getData();
             $em->persist($add);
             $em->flush();
             $this->get('session')->getFlashBag()->add('notice', 'enregistré');
         } catch (\Exception $e) {
             $this->get('session')->getFlashBag()->add('erreur', $e);
         }
     }
     return $this->render('CandidatBundle:Pages:addcompetence.html.twig', array('form' => $form->createView()));
 }
 /**
  * {@inheritDoc}
  */
 public function getIdDomaineCompetence()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getIdDomaineCompetence', array());
     return parent::getIdDomaineCompetence();
 }