Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function add($name, $price)
- {
- $entityManager = $this->getDoctrine()->getManager();
- $product = new Product();
- $product->setName($name);
- $product->setPrice($price);
- $entityManager->persist($product);
- $entityManager->flush();
- return new Response('Saved new product with id '.$product->getId());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement