예제 #1
0
 public function createAction($format)
 {
     try {
         $em = $this->getDoctrine()->getManager();
         $group = new Group();
         $params = array();
         $content = $this->get("request")->getContent();
         if (!empty($content)) {
             $params = json_decode($content, true);
             $group->setName($params['name']);
             $group->setRoles($params['roles']);
         }
         $em->persist($group);
         $em->flush();
         return $this->formatResponse("ok", $format);
     } catch (Exception $ex) {
         return $this->formatResponse("error", $format);
     }
 }