src/Sulu/Bundle/CategoryBundle/Controller/KeywordController.php
public function postAction($categoryId, Request $request)
    {
        /** @var KeywordInterface $keyword */
        $keyword = $this->getKeywordRepository()->createNew();
        $category = $this->getCategoryRepository()->findCategoryById($categoryId);
        $keyword->setKeyword($request->get('keyword'));
        $keyword->setLocale($request->get('locale'));

        $keyword = $this->getKeywordManager()->save($keyword, $category);

        $this->getEntityManager()->persist($keyword);
        $this->getEntityManager()->flush();

        return $this->handleView($this->view($keyword));
    }
public function postAction($categoryId, Request $request)
    {
        /** @var KeywordInterface $keyword */
        $keyword = $this->getKeywordRepository()->createNew();
        $category = $this->getCategoryRepository()->findCategoryById($categoryId);
        $keyword->setKeyword($request->get('keyword'));
        $keyword->setLocale($request->get('locale'));

        $keyword = $this->getKeywordManager()->save($keyword, $category);

        $this->getEntityManager()->persist($keyword);
        $this->getEntityManager()->flush();

        return $this->handleView($this->view($keyword));
    }
public function postAction ( $ categoryId , Request $ request ) { /** @var KeywordInterface $keyword */ $ keyword = $ this -> getKeywordRepository ( ) -> createNew ( ) ; $ category = $ this -> getCategoryRepository ( ) -> findCategoryById ( $ categoryId ) ; $ keyword -> setKeyword ( $ request -> get ( 'keyword' ) ) ; $ keyword -> setLocale ( $ request -> get ( 'locale' ) ) ; $ keyword = $ this -> getKeywordManager ( ) -> save ( $ keyword , $ category ) ; $ this -> getEntityManager ( ) -> persist ( $ keyword ) ; $ this -> getEntityManager ( ) -> flush ( ) ; return $ this -> handleView ( $ this -> view ( $ keyword ) ) ; }
Creates new keyword for given category.

@param int $categoryId
@param Request $request

@return Response
Creates new keyword for given category .