public function addProductAction() { if (!empty($_POST)) { $product = new Product(); $product->setName(htmlentities($_POST["name"])); $product->setContent(htmlentities($_POST["content"])); $em = $this->getEntityManager(); $em->persist($product); $em->flush(); return $this->redirectTo(); } return $this->renderView("productAdd.html.twig"); }