public function indexAction() { $categories = new Categories(); $categories->setName('Computer Peripherals'); $product = new Product(); $product->setName('Keyboard'); $product->setPrice(19.99); $product->setDescription('Ergonomic and stylish!'); $product->setCategory($categories); $em = $this->getDoctrine()->getManager(); $em->persist($categories); $em->persist($product); $em->flush(); return new Response('<html><head></head><body>Test</body></html>'); }
/** * Creates a form to delete a Categories entity. * * @param Categories $category The Categories entity * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm(Categories $category) { return $this->createFormBuilder()->setAction($this->generateUrl('categories_delete', array('id' => $category->getId())))->setMethod('DELETE')->getForm(); }