src/Controller/BlogController.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Pimcore\Controller\FrontendController;
  4. use Pimcore\Model\DataObject\Blog;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Knp\Component\Pager\PaginatorInterface;
  8. use Elasticsearch\Client;   
  9. class BlogController extends BaseController
  10. {
  11.     const BLOG_DEFAULT_DOCUMENT_PROPERTY_NAME 'blog_default_document';
  12.   
  13.      /**
  14.      * @param Request $request
  15.      *
  16.      * @return Response
  17.      *
  18.      * @throws \Exception
  19.      */
  20.      public function listingAction(Request $requestPaginatorInterface $paginator)
  21.     {
  22.         $blogListing = new Blog\Listing();
  23.         $blogListing->setOrderKey('pubDate');
  24.         $blogListing->setOrder('DESC');
  25.         $paginator $paginator->paginate(
  26.             $blogListing,
  27.             $request->get('page'1),
  28.             6
  29.         );
  30.         return $this->render('blog/listing.html.twig', [
  31.             'blogListing' => $paginator,
  32.             'paginationVariables' => $paginator->getPaginationData()
  33.         ]);
  34.    
  35.     }
  36.     
  37. }