<?php
namespace App\Controller;
use Pimcore\Controller\FrontendController;
use Pimcore\Model\DataObject\Blog;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Knp\Component\Pager\PaginatorInterface;
use Elasticsearch\Client;
class BlogController extends BaseController
{
const BLOG_DEFAULT_DOCUMENT_PROPERTY_NAME = 'blog_default_document';
/**
* @param Request $request
*
* @return Response
*
* @throws \Exception
*/
public function listingAction(Request $request, PaginatorInterface $paginator)
{
$blogListing = new Blog\Listing();
$blogListing->setOrderKey('pubDate');
$blogListing->setOrder('DESC');
$paginator = $paginator->paginate(
$blogListing,
$request->get('page', 1),
6
);
return $this->render('blog/listing.html.twig', [
'blogListing' => $paginator,
'paginationVariables' => $paginator->getPaginationData()
]);
}
}