public function onSuccess(Film $film, \RNC\UserBundle\Entity\User $user) { /* à modifier */ $film->setUser($user); $rep = $this->em->getRepository('RNCFilmBundle:Status'); $film->setStatus($rep->findOneBy(array('type' => 'waiting'))); $rep = $this->em->getRepository('RNCFilmBundle:Category'); $film->setCategory($rep->findOneBy(array('name' => 'none'))); $this->em->persist($film->getProducer()); $this->em->persist($film->getDirector()); $this->em->persist($film->getCategory()); $this->em->persist($film->getStatus()); $this->em->persist($film->getUser()); $this->em->persist($film); $this->em->flush(); }