public function showSearchResultsAction(Request $request)
    {
        $response = new Response();
        $searchText = '';
        $searchCount = 0;

        // Creating a form using Symfony's form component
        $simpleSearch = new SimpleSearch();
        $form = $this->createForm($this->get('ezdemo.form.type.simple_search'), $simpleSearch);
        $form->handleRequest($request);

        $pager = null;

        if ($form->isValid()) {
            /** @var SearchHelper $searchHelper */
            $searchHelper = $this->get('ezdemo.search_helper');

            if (!empty($simpleSearch->searchText)) {
                $searchText = $simpleSearch->searchText;

                $pager = $searchHelper->searchForPaginatedContent(
                    $searchText,
                    $request->get('page', 1),
                    $this->getConfigResolver()->getParameter('languages')
                );

                $searchCount = $pager->getNbResults();
            }
        }

        return $this->render(
            'eZDemoBundle:search:search.html.twig',
            array(
                'searchText' => $searchText,
                'searchCount' => $searchCount,
                'pagerSearch' => $pager,
                'form' => $form->createView(),
            ),
            $response
        );
    }
public function showSearchResultsAction(Request $request)
    {
        $response = new Response();
        $searchText = '';
        $searchCount = 0;

        // Creating a form using Symfony's form component
        $simpleSearch = new SimpleSearch();
        $form = $this->createForm($this->get('ezdemo.form.type.simple_search'), $simpleSearch);
        $form->handleRequest($request);

        $pager = null;

        if ($form->isValid()) {
            /** @var SearchHelper $searchHelper */
            $searchHelper = $this->get('ezdemo.search_helper');

            if (!empty($simpleSearch->searchText)) {
                $searchText = $simpleSearch->searchText;

                $pager = $searchHelper->searchForPaginatedContent(
                    $searchText,
                    $request->get('page', 1),
                    $this->getConfigResolver()->getParameter('languages')
                );

                $searchCount = $pager->getNbResults();
            }
        }

        return $this->render(
            'eZDemoBundle:search:search.html.twig',
            array(
                'searchText' => $searchText,
                'searchCount' => $searchCount,
                'pagerSearch' => $pager,
                'form' => $form->createView(),
            ),
            $response
        );
    }
public function showSearchResultsAction ( Request $ request ) { $ response = new Response ( ) ; $ searchText = '' ; $ searchCount = 0 ; // Creating a form using Symfony's form component $ simpleSearch = new SimpleSearch ( ) ; $ form = $ this -> createForm ( $ this -> get ( 'ezdemo.form.type.simple_search' ) , $ simpleSearch ) ; $ form -> handleRequest ( $ request ) ; $ pager = null ; if ( $ form -> isValid ( ) ) { /** @var SearchHelper $searchHelper */ $ searchHelper = $ this -> get ( 'ezdemo.search_helper' ) ; if ( ! empty ( $ simpleSearch -> searchText ) ) { $ searchText = $ simpleSearch -> searchText ; $ pager = $ searchHelper -> searchForPaginatedContent ( $ searchText , $ request -> get ( 'page' , 1 ) , $ this -> getConfigResolver ( ) -> getParameter ( 'languages' ) ) ; $ searchCount = $ pager -> getNbResults ( ) ; } } return $ this -> render ( 'eZDemoBundle:search:search.html.twig' , array ( 'searchText' => $ searchText , 'searchCount' => $ searchCount , 'pagerSearch' => $ pager , 'form' => $ form -> createView ( ) , ) , $ response ) ; }
Displays the simple search page.

@param Request $request

@return Response
Displays the simple search page .