/** * @Route("/", name="log_store") * @Method("POST") */ public function storeAction(Employee $employee, Request $request) { $log = new Log(); $form = $this->createForm(new LogType(), $log); $form->add('card', 'entity', ['class' => 'TimetrackerBundle:Card', 'choices' => $employee->getCards(), 'property' => 'signature']); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); $log->setIsEdited(false); $em->persist($log); $em->flush(); return $this->redirect($this->generateUrl('calendar_show', $this->getLogDateArray($log))); } return $this->render('TimetrackerBundle:Log:new.html.twig', ['form' => $form->createView()]); }