/** *tworzenie zamowienia * @param Entity\Car $car * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function rentAction(Entity\Car $car) { $user = $this->get('security.token_storage')->getToken()->getUser(); $order = new Entity\CarOrder(); $order->setCar($car); $order->setUser($user); $order->setDateFrom(new \DateTime()); $order->setDateTo((new \DateTime())->add(new \DateInterval('P1D'))); $em = $this->getDoctrine()->getManager(); $em->persist($order); $em->flush(); return $this->redirectToRoute('app_orders'); }