src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php
protected function enterRequestScope($lang)
    {
        $requestStack = $this->container->get('request_stack');
        // If there already is a request, get the locale from it.
        if ($requestStack->getCurrentRequest()) {
            $locale = $requestStack->getCurrentRequest()->getLocale();
        }
        // If we don't have a request or the current request locale is different from the node langauge
        if (!$requestStack->getCurrentRequest() || ($locale && $locale !== $lang)) {
            $request = new Request();
            $request->setLocale($lang);

            $context = $this->container->get('router')->getContext();
            $context->setParameter('_locale', $lang);

            $requestStack->push($request);
        }
    }
protected function enterRequestScope($lang)
    {
        $requestStack = $this->container->get('request_stack');
        // If there already is a request, get the locale from it.
        if ($requestStack->getCurrentRequest()) {
            $locale = $requestStack->getCurrentRequest()->getLocale();
        }
        // If we don't have a request or the current request locale is different from the node langauge
        if (!$requestStack->getCurrentRequest() || ($locale && $locale !== $lang)) {
            $request = new Request();
            $request->setLocale($lang);

            $context = $this->container->get('router')->getContext();
            $context->setParameter('_locale', $lang);

            $requestStack->push($request);
        }
    }
protected function enterRequestScope ( $ lang ) { $ requestStack = $ this -> container -> get ( 'request_stack' ) ; // If there already is a request, get the locale from it. if ( $ requestStack -> getCurrentRequest ( ) ) { $ locale = $ requestStack -> getCurrentRequest ( ) -> getLocale ( ) ; } // If we don't have a request or the current request locale is different from the node langauge if ( ! $ requestStack -> getCurrentRequest ( ) || ( $ locale && $ locale !== $ lang ) ) { $ request = new Request ( ) ; $ request -> setLocale ( $ lang ) ; $ context = $ this -> container -> get ( 'router' ) -> getContext ( ) ; $ context -> setParameter ( '_locale' , $ lang ) ; $ requestStack -> push ( $ request ) ; } }
Enter request scope if it is not active yet...

@param string $lang
Enter request scope if it is not active yet ...