public function searchLocationAction( $locationId, $viewType, $layout = false, array $params = array() )
    {
        $repository = $this->getRepository();
        $location = $repository->getLocationService()->loadLocation( $locationId );

        try {
            /** @var SearchAdapter $searchAdapter */
            $searchAdapter = $this->get('netgen_search_and_filter.location_'.$locationId);
        } catch (ServiceNotFoundException $e) {
            return $this->get( 'ez_content' )->viewLocation( $locationId, $viewType, $layout, $params );
        }

        /** @var Form $form */
        $form = $searchAdapter->getForm();

        $response = new Response();
        $response->headers->set( 'X-Location-Id', $locationId );
        $response->setVary( 'X-User-Hash' );

        $pager = new Pagerfanta( $searchAdapter );
        $pager->setMaxPerPage( $searchAdapter->getPageLimit() );

        $showResults = $this->getPage( $pager, $form );

        return $this->render($searchAdapter->getResultTemplate(), array(
            'pagelayout' => $this->container->getParameter("netgen_search_and_filter.main_pagelayout"),
            'form_template' => $searchAdapter->getFormTemplate(),
            'form' => $form->createView(),
            'location' => $location,
            'content' => $repository->getContentService()->loadContentByContentInfo( $location->getContentInfo() ),
            'pager' => $pager,
            'show_results' => $showResults,
            'query_string' => array($form->getName() => $form->getData()),
            'current_locale' => $this->getConfigResolver()->getParameter('RegionalSettings.Locale')
        ), $response);

    }
public function searchLocationAction( $locationId, $viewType, $layout = false, array $params = array() )
    {
        $repository = $this->getRepository();
        $location = $repository->getLocationService()->loadLocation( $locationId );

        try {
            /** @var SearchAdapter $searchAdapter */
            $searchAdapter = $this->get('netgen_search_and_filter.location_'.$locationId);
        } catch (ServiceNotFoundException $e) {
            return $this->get( 'ez_content' )->viewLocation( $locationId, $viewType, $layout, $params );
        }

        /** @var Form $form */
        $form = $searchAdapter->getForm();

        $response = new Response();
        $response->headers->set( 'X-Location-Id', $locationId );
        $response->setVary( 'X-User-Hash' );

        $pager = new Pagerfanta( $searchAdapter );
        $pager->setMaxPerPage( $searchAdapter->getPageLimit() );

        $showResults = $this->getPage( $pager, $form );

        return $this->render($searchAdapter->getResultTemplate(), array(
            'pagelayout' => $this->container->getParameter("netgen_search_and_filter.main_pagelayout"),
            'form_template' => $searchAdapter->getFormTemplate(),
            'form' => $form->createView(),
            'location' => $location,
            'content' => $repository->getContentService()->loadContentByContentInfo( $location->getContentInfo() ),
            'pager' => $pager,
            'show_results' => $showResults,
            'query_string' => array($form->getName() => $form->getData()),
            'current_locale' => $this->getConfigResolver()->getParameter('RegionalSettings.Locale')
        ), $response);

    }
public function searchLocationAction ( $ locationId , $ viewType , $ layout = false , array $ params = array ( ) ) { $ repository = $ this -> getRepository ( ) ; $ location = $ repository -> getLocationService ( ) -> loadLocation ( $ locationId ) ; try { /** @var SearchAdapter $searchAdapter */ $ searchAdapter = $ this -> get ( 'netgen_search_and_filter.location_' . $ locationId ) ; } catch ( ServiceNotFoundException $ e ) { return $ this -> get ( 'ez_content' ) -> viewLocation ( $ locationId , $ viewType , $ layout , $ params ) ; } /** @var Form $form */ $ form = $ searchAdapter -> getForm ( ) ; $ response = new Response ( ) ; $ response -> headers -> set ( 'X-Location-Id' , $ locationId ) ; $ response -> setVary ( 'X-User-Hash' ) ; $ pager = new Pagerfanta ( $ searchAdapter ) ; $ pager -> setMaxPerPage ( $ searchAdapter -> getPageLimit ( ) ) ; $ showResults = $ this -> getPage ( $ pager , $ form ) ; return $ this -> render ( $ searchAdapter -> getResultTemplate ( ) , array ( 'pagelayout' => $ this -> container -> getParameter ( "netgen_search_and_filter.main_pagelayout" ) , 'form_template' => $ searchAdapter -> getFormTemplate ( ) , 'form' => $ form -> createView ( ) , 'location' => $ location , 'content' => $ repository -> getContentService ( ) -> loadContentByContentInfo ( $ location -> getContentInfo ( ) ) , 'pager' => $ pager , 'show_results' => $ showResults , 'query_string' => array ( $ form -> getName ( ) => $ form -> getData ( ) ) , 'current_locale' => $ this -> getConfigResolver ( ) -> getParameter ( 'RegionalSettings.Locale' ) ) , $ response ) ; }
Action for rendering search page for Location
Action for rendering search page for Location