/**
  * @Route("/product/create")
  * @Method({"POST", "GET"})
  * @Template()
  *
  */
 public function createAction(Request $request)
 {
     $db = $this->getDoctrine()->getManager();
     try {
         $product = new Product();
         $product->setName($request->get('name'));
         $db->persist($product);
         $db->flush();
         $message = 'Product %s was successfully created';
         $message = sprintf($message, $request->get('name'));
     } catch (\Exception $e) {
         $message = 'Error: ' . $e->getMessage();
     }
     return new JsonResponse(array('message' => $message));
 }
 /**
  * {@inheritDoc}
  */
 public function getName()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getName', array());
     return parent::getName();
 }