public function create() { $Request = $this->container->get('Core\\Http\\Request\\Request'); if ($Request->getMethod() == 'POST') { $form = $Request->getPost()->get('form'); if ($form->get('title') && $form->get('content')) { $em = $this->container->get('Core\\Orm\\Orm')->getEntityManager(); $Product = new Product(); $Product->setName($form->get('title')); $Product->setContent($form->get('content')); $em->persist($Product); $em->flush(); $flash = "Added"; } else { $flash = "Empty"; } } return new Response('Default/create.html.twig', ['flash' => !empty($flash) ? $flash : '']); }