/** * @Route("{_locale}/product/new", name="productNew") */ public function newAction(Request $request) { $product = new Product(); /*$product->setName(''); $product->setPrice('160'); $product->setDescription('Samsung 50');*/ $product->setDueDate(new \DateTime()); $form = $this->createForm(new ProductType(), $product); $form->handleRequest($request); if ($form->isValid()) { //$data = $form->getData(); //dump($product);die(); $em = $this->getDoctrine()->getManager(); $em->persist($product); $em->flush(); return $this->redirectToRoute('productNew'); } return $this->render('product/new.html.twig', array('form' => $form->createView())); }