/** * @Route("/experiment/new", name="newExperiment") */ public function experimentAction(Request $request) { $exp = new Experiment(); $exp->setName($request->get('_expname')); $exp->setDescription($request->get('_description')); $exp->setExpDate(new \DateTime(date('d.m.Y', strtotime($request->get('_expdate'))))); $exp->setProcessor($request->get('_processor')); $exp->setStatus($request->get('_status')); $user = $this->getUser(); $exp->setUser($user); $em = $this->getDoctrine()->getManager(); $em->persist($user); $em->persist($exp); $em->flush(); // return $this->redirectToRoute('aboutExperiment', array('id' => $exp->getId())); return $this->redirectToRoute('userExperiment', array('id' => $user->getId(), 'experimentId' => $exp->getId())); }
/** * Add experiment * * @param \AppBundle\Entity\Experiment $experiment * * @return SequenceRun */ public function add(\AppBundle\Entity\Experiment $experiment) { $this->experiments[] = $experiment; $experiment->setSequenceRun($this); }