forked from audrey/intranet
handle no tickets results returned from search
This commit is contained in:
parent
a65e11f3b8
commit
d6e700ca4b
@ -34,12 +34,14 @@ class CSPController extends AbstractController
|
|||||||
$searchQuery = $ticketsRepo->getByKeyword($searchKeywords);
|
$searchQuery = $ticketsRepo->getByKeyword($searchKeywords);
|
||||||
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($searchQuery);
|
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($searchQuery);
|
||||||
$ticketsPerPage = count($paginator);
|
$ticketsPerPage = count($paginator);
|
||||||
|
//If no tickets were found, return a special page.
|
||||||
|
//NOTE: we set page information to 1 of 1. Paginator has no tickets, which we're letting the twig template deal with.
|
||||||
|
return $this->render('cspViewer.html.twig',['tickets' => $paginator, 'portal' => $portal, 'pageNum' => 1, 'pageCount' => 1, 'form' => $form]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($query);
|
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Pagination
|
//Pagination
|
||||||
$totalItems = count($paginator);
|
$totalItems = count($paginator);
|
||||||
$pageCount = ceil($totalItems / $ticketsPerPage);
|
$pageCount = ceil($totalItems / $ticketsPerPage);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user