Пример #1
0
 public function modifiertypeAction(OffreEmploi $offre)
 {
     $em = $this->getDoctrine()->getManager();
     $user = $this->get('security.context')->getToken()->getUser();
     $requete = $this->get('request');
     if ($requete->isMethod('POST')) {
         if (!empty($_POST['lieu'])) {
             $offre->setLieuTravail(trim(htmlspecialchars($_POST['lieu'])));
         }
         if (!empty($_POST['typeposte'])) {
             $offre->setTypePoste(trim(htmlspecialchars($_POST['typeposte'])));
         }
         if (!empty($_POST['typecontrat'])) {
             $offre->setTypeContrat(trim(htmlspecialchars($_POST['typecontrat'])));
         }
         if (!empty($_POST['xpexigee'])) {
             $offre->setXpExigee(trim(htmlspecialchars($_POST['xpexigee'])));
         }
         if (!empty($_POST['dureevalidite'])) {
             $offre->setDureeValidite(trim(htmlspecialchars($_POST['dureevalidite'])));
         }
         if (!empty($_POST['urgence'])) {
             $offre->setUrgence(trim(htmlspecialchars($_POST['urgence'])));
         }
         if (!empty($_POST['salaire'])) {
             $offre->setSalaire(trim(htmlspecialchars($_POST['salaire'])));
         }
         $em->persist($offre);
         $em->flush();
         $notification = new Notification();
         $notification->setAction('Modification d\'une offre')->setDescriptif('L\'utilisateur ' . $user->getUsername() . ' a modifié l\'offre : ' . $offre->getTitre())->setIdUser($user->getId())->setIdOffre($offre->getId());
         $em->persist($notification);
         $em->flush();
     }
     return $this->redirect($this->generateUrl('amie_offresemplois_offre', array('id' => $offre->getId(), 'slug' => $this->get('slugify')->slugify($offre->getTitre()))));
 }