/**
* @param $page
* @param null $template
*
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Exception
*/
public function renderList($page, $template = null)
{
$user = $this->getUser();
$tpl = null === $template ? $this->templatePath . 'list.html.twig' : $template;
if ($this->filterForm) {
$this->filterForm = $this->createForm($this->filterForm);
}
$qb = $this->buildFilterQuery();
$paginator = $this->get('knp_paginator');
$pagination = $paginator->paginate($qb->getQuery(), $page, $this->list_item_per_page, $this->defaultSortList);
return $this->render($tpl, array('user' => $user, 'nbPerPage' => $this->list_item_per_page, 'page' => $page, 'form' => $this->filterForm ? $this->filterForm->createView() : null, 'baseRoute' => $this->baseRoute, 'entityName' => $this->entityName, 'list' => ['records' => $pagination, 'fields' => $this->listColumn, 'parameters' => $this->listConf, 'actions' => $this->listActions], 'actionsList' => $this->actionsList(), 'listTitle' => $this->listTitle));
}