示例#1
0
 /**
  * @Route("/market/category/add" , name="market_category_add" )
  */
 public function addCategoryAction()
 {
     $MarketManager = $this->isAuth();
     if (!$this->isAuth()) {
         return $this->redirect($this->generateUrl("market_login"));
     }
     if ($MarketManager) {
         $request = $this->getRequest();
         if ($request->isMethod('POST')) {
             $em = $this->getDoctrine()->getManager();
             $category = new MarketCategory();
             $category->setEnabled($request->get('enabled'));
             $category->setName($request->get('name'));
             $category->setMarketUser($MarketManager);
             $category->setOfferId($request->get('offerId'));
             $em->persist($category);
             $em->flush();
             return $this->redirect($this->generateUrl('market_categor_lists'));
         }
         return $this->render('EvrikaMainBundle:Market:category_.html.twig', array('auth' => $MarketManager));
     }
 }