PHP code example of ongr / filter-manager-bundle

1. Go to this page and download the library: Download ongr/filter-manager-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ongr / filter-manager-bundle example snippets


// config/bundles.php



return [
    ...

    ONGR\ElasticsearchBundle\ONGRElasticsearchBundle::class => ['all' => true],
    ONGR\FilterManagerBundle\ONGRFilterManagerBundle::class => ['all' => true],
    JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],

    ...
];

  
   
  use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\HttpFoundation\Response;
   
  class ProductController extends Controller
  {
      /**
       * @param Request $request Request.
       *
       * @return Response
       */
      public function listAction(Request $request)
      {
          $searchList = $this->get(ONGRFilterManagerExtension::getFilterManagerId('search_list'))
                            ->handleRequest($request);
          $this->render(
              'AppBundle:Product:list.html.twig',
              [
                'filters' => $searchList->getFilters(),  
                'products' => $searchList->getResult(),  
              ]
          );                  
      }
  }