Bundle/BlogBundle/Controller/BlogController.php
public function indexAction(Request $request, $blog = null, $tab = 'articles')
    {
        /** @var BlogRepository $blogRepo */
        $blogRepo = $this->get('doctrine.orm.entity_manager')->getRepository('VictoireBlogBundle:Blog');

        // Default value for locale
        $locale = $request->getLocale();

        // Overwrite locale when a locale is chosen in the form
        if ($chooseBlog = $request->request->get('choose_blog')) {
            if (array_key_exists('locale', $chooseBlog)) {
                $locale = $chooseBlog['locale'];
            }
        }

        $parameters = [
            'locale'             => $locale,
            'blog'               => $blog,
            'currentTab'         => $tab,
            'tabs'               => ['articles', 'drafts', 'settings', 'category'],
            'businessProperties' => $blog ? $this->getBusinessProperties($blog) : null,
        ];
        if ($blogRepo->hasMultipleBlog()) {
            $chooseBlogForm = $this->createForm(ChooseBlogType::class, null, [
                'blog'   => $blog,
                'locale' => $locale,
            ]);
            $chooseBlogForm->handleRequest($request);
            $parameters = array_merge(
                $parameters,
                ['chooseBlogForm' => $chooseBlogForm->createView()],
                $chooseBlogForm->getData()
            );
        }

        return $this->render(
            'VictoireBlogBundle:Blog:index.html.twig',
            $parameters
        );
    }
public function indexAction(Request $request, $blog = null, $tab = 'articles')
    {
        /** @var BlogRepository $blogRepo */
        $blogRepo = $this->get('doctrine.orm.entity_manager')->getRepository('VictoireBlogBundle:Blog');

        // Default value for locale
        $locale = $request->getLocale();

        // Overwrite locale when a locale is chosen in the form
        if ($chooseBlog = $request->request->get('choose_blog')) {
            if (array_key_exists('locale', $chooseBlog)) {
                $locale = $chooseBlog['locale'];
            }
        }

        $parameters = [
            'locale'             => $locale,
            'blog'               => $blog,
            'currentTab'         => $tab,
            'tabs'               => ['articles', 'drafts', 'settings', 'category'],
            'businessProperties' => $blog ? $this->getBusinessProperties($blog) : null,
        ];
        if ($blogRepo->hasMultipleBlog()) {
            $chooseBlogForm = $this->createForm(ChooseBlogType::class, null, [
                'blog'   => $blog,
                'locale' => $locale,
            ]);
            $chooseBlogForm->handleRequest($request);
            $parameters = array_merge(
                $parameters,
                ['chooseBlogForm' => $chooseBlogForm->createView()],
                $chooseBlogForm->getData()
            );
        }

        return $this->render(
            'VictoireBlogBundle:Blog:index.html.twig',
            $parameters
        );
    }
public function indexAction ( Request $ request , $ blog = null , $ tab = 'articles' ) { /** @var BlogRepository $blogRepo */ $ blogRepo = $ this -> get ( 'doctrine.orm.entity_manager' ) -> getRepository ( 'VictoireBlogBundle:Blog' ) ; // Default value for locale $ locale = $ request -> getLocale ( ) ; // Overwrite locale when a locale is chosen in the form if ( $ chooseBlog = $ request -> request -> get ( 'choose_blog' ) ) { if ( array_key_exists ( 'locale' , $ chooseBlog ) ) { $ locale = $ chooseBlog [ 'locale' ] ; } } $ parameters = [ 'locale' => $ locale , 'blog' => $ blog , 'currentTab' => $ tab , 'tabs' => [ 'articles' , 'drafts' , 'settings' , 'category' ] , 'businessProperties' => $ blog ? $ this -> getBusinessProperties ( $ blog ) : null , ] ; if ( $ blogRepo -> hasMultipleBlog ( ) ) { $ chooseBlogForm = $ this -> createForm ( ChooseBlogType :: class , null , [ 'blog' => $ blog , 'locale' => $ locale , ] ) ; $ chooseBlogForm -> handleRequest ( $ request ) ; $ parameters = array_merge ( $ parameters , [ 'chooseBlogForm' => $ chooseBlogForm -> createView ( ) ] , $ chooseBlogForm -> getData ( ) ) ; } return $ this -> render ( 'VictoireBlogBundle:Blog:index.html.twig' , $ parameters ) ; }
List all Blogs.

@Route("/index/{blogId}/{tab}", name="victoire_blog_index", defaults={"blogId" = null, "tab" = "articles"})
@ParamConverter("blog", class="VictoireBlogBundle:Blog", options={"id" = "blogId"})

@param Request $request

@throws \OutOfBoundsException

@return JsonResponse
List all Blogs .