public function addAction(Request $request)
 {
     $advert = new Advert();
     $advert->setTitle('Recherche développeur Symfony2.');
     $advert->setAuthor('Alexandre');
     $advert->setContent("Nous recherchons un développeur Symfony2 débutant sur Lyon. Blabla…");
     $image = new Image();
     $image->setUrl('http://sdz-upload.s3.amazonaws.com/prod/upload/job-de-reve.jpg');
     $image->setAlt('Job de rêve');
     $advert->setImage($image);
     $application1 = new Application();
     $application1->setAuthor('Marine');
     $application1->setContent("J'ai toutes les qualités requises.");
     $application2 = new Application();
     $application2->setAuthor('Pierre');
     $application2->setContent("Je suis très motivé.");
     $application1->setAdvert($advert);
     $application2->setAdvert($advert);
     $em = $this->getDoctrine()->getManager();
     $em->persist($advert);
     $em->persist($application1);
     $em->persist($application2);
     $em->flush();
     if ($request->isMethod('POST')) {
         $request->getSession()->getFlashBag()->add('notice', 'Annonce bien enregistrée.');
         return $this->redirect($this->generateUrl('apb_platform_view', array('id' => $advert->getId())));
     }
     return $this->render('APBPlatformBundle:Advert:add.html.twig');
 }
 /**
  * {@inheritDoc}
  */
 public function getAlt()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getAlt', array());
     return parent::getAlt();
 }