Bundle/BlogBundle/Controller/ArticleController.php
public function settingsPostAction(Request $request, Article $article)
    {
        $form = $this->createForm(ArticleSettingsType::class, $article);
        $form->handleRequest($request);

        $novalidate = $request->query->get('novalidate', false);

        if ($novalidate === false && $form->isValid()) {
            $page = $this->get('victoire_blog.manager.article')->updateSettings(
                $article,
                $this->getUser()
            );

            $response = [
                'success' => true,
                'url'     => $this->generateUrl('victoire_core_page_show', [
                    '_locale' => $page->getCurrentLocale(),
                    'url'     => $page->getReference()->getUrl(),
                ]),
            ];
        } else {
            $response = $this->getNotPersistedSettingsResponse($form, $article, $novalidate);
        }

        return new JsonResponse($response);
    }
public function settingsPostAction(Request $request, Article $article)
    {
        $form = $this->createForm(ArticleSettingsType::class, $article);
        $form->handleRequest($request);

        $novalidate = $request->query->get('novalidate', false);

        if ($novalidate === false && $form->isValid()) {
            $page = $this->get('victoire_blog.manager.article')->updateSettings(
                $article,
                $this->getUser()
            );

            $response = [
                'success' => true,
                'url'     => $this->generateUrl('victoire_core_page_show', [
                    '_locale' => $page->getCurrentLocale(),
                    'url'     => $page->getReference()->getUrl(),
                ]),
            ];
        } else {
            $response = $this->getNotPersistedSettingsResponse($form, $article, $novalidate);
        }

        return new JsonResponse($response);
    }
public function settingsPostAction ( Request $ request , Article $ article ) { $ form = $ this -> createForm ( ArticleSettingsType :: class , $ article ) ; $ form -> handleRequest ( $ request ) ; $ novalidate = $ request -> query -> get ( 'novalidate' , false ) ; if ( $ novalidate === false && $ form -> isValid ( ) ) { $ page = $ this -> get ( 'victoire_blog.manager.article' ) -> updateSettings ( $ article , $ this -> getUser ( ) ) ; $ response = [ 'success' => true , 'url' => $ this -> generateUrl ( 'victoire_core_page_show' , [ '_locale' => $ page -> getCurrentLocale ( ) , 'url' => $ page -> getReference ( ) -> getUrl ( ) , ] ) , ] ; } else { $ response = $ this -> getNotPersistedSettingsResponse ( $ form , $ article , $ novalidate ) ; } return new JsonResponse ( $ response ) ; }
Save Blog Article settings.

@param Request $request
@param Article $article

@Route("/{id}/settings", name="victoire_blog_article_settings_post")
@Method("POST")

@ParamConverter("article", class="VictoireBlogBundle:Article")

@throws \Victoire\Bundle\ViewReferenceBundle\Exception\ViewReferenceNotFoundException

@return JsonResponse
Save Blog Article settings .