public function addAction() {

        $edit_form = $this->container->get("haven_core.category.form_handler")->createNewForm();

        $request = $this->container->get('request_modifier')->setRequest($this->container->get("request"))
                ->slug(array("name"))
                ->getRequest();

        $edit_form->bind($request);

        if ($edit_form->isValid()) {
            $this->container->get("haven_core.category.persistence_handler")->save($edit_form->getData());
            $this->container->get("session")->getFlashBag()->add("success", "create.success");

            return new RedirectResponse($this->container->get('router')->generate(str_replace('update', "list", $this->container->get("request")->get("_route"))));
        }

        $this->container->get("session")->getFlashBag()->add("error", "create.error");

        $template = str_replace(":create.html.twig", ":new.html.twig", $this->container->get("request")->get('_template'));
        $params = array(
            'edit_form' => $edit_form->createView()
        );

        return new Response($this->container->get('templating')->render($template, $params));
    }
public function addAction() {

        $edit_form = $this->container->get("haven_core.category.form_handler")->createNewForm();

        $request = $this->container->get('request_modifier')->setRequest($this->container->get("request"))
                ->slug(array("name"))
                ->getRequest();

        $edit_form->bind($request);

        if ($edit_form->isValid()) {
            $this->container->get("haven_core.category.persistence_handler")->save($edit_form->getData());
            $this->container->get("session")->getFlashBag()->add("success", "create.success");

            return new RedirectResponse($this->container->get('router')->generate(str_replace('update', "list", $this->container->get("request")->get("_route"))));
        }

        $this->container->get("session")->getFlashBag()->add("error", "create.error");

        $template = str_replace(":create.html.twig", ":new.html.twig", $this->container->get("request")->get('_template'));
        $params = array(
            'edit_form' => $edit_form->createView()
        );

        return new Response($this->container->get('templating')->render($template, $params));
    }
public function addAction ( ) { $ edit_form = $ this -> container -> get ( "haven_core.category.form_handler" ) -> createNewForm ( ) ; $ request = $ this -> container -> get ( 'request_modifier' ) -> setRequest ( $ this -> container -> get ( "request" ) ) -> slug ( array ( "name" ) ) -> getRequest ( ) ; $ edit_form -> bind ( $ request ) ; if ( $ edit_form -> isValid ( ) ) { $ this -> container -> get ( "haven_core.category.persistence_handler" ) -> save ( $ edit_form -> getData ( ) ) ; $ this -> container -> get ( "session" ) -> getFlashBag ( ) -> add ( "success" , "create.success" ) ; return new RedirectResponse ( $ this -> container -> get ( 'router' ) -> generate ( str_replace ( 'update' , "list" , $ this -> container -> get ( "request" ) -> get ( "_route" ) ) ) ) ; } $ this -> container -> get ( "session" ) -> getFlashBag ( ) -> add ( "error" , "create.error" ) ; $ template = str_replace ( ":create.html.twig" , ":new.html.twig" , $ this -> container -> get ( "request" ) -> get ( '_template' ) ) ; $ params = array ( 'edit_form' => $ edit_form -> createView ( ) ) ; return new Response ( $ this -> container -> get ( 'templating' ) -> render ( $ template , $ params ) ) ; }
Creates a new persona entity.

@Route("/admin/create/category")

@Method("POST")
@Template
Creates a new persona entity .