/** * @Route("/contrat/{id}/reconduction", name="contrat_reconduction") * @ParamConverter("contrat", class="AppBundle:Contrat") */ public function reconductionAction(Request $request, Contrat $contrat) { $dm = $this->get('doctrine_mongodb')->getManager(); if ($contrat->isReconductible()) { $etablissements = $contrat->getEtablissements(); $contratReconduit = $contrat->reconduire(); $dm->persist($contratReconduit); $dm->flush(); $this->get('contrat.manager')->copyPassagesForContratReconduit($contratReconduit, $contrat); $dm->persist($contratReconduit); $contrat->setReconduit(true); $dm->persist($contratReconduit); $dm->flush(); return $this->redirectToRoute('contrats_societe', array('id' => $contratReconduit->getSociete()->getId())); } else { return $this->redirectToRoute('contrat_visualisation', array('id' => $contrat->getId())); } }