mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-02 13:03:50 +00:00
fix gitlab tests
This commit is contained in:
@@ -52,12 +52,32 @@ class ReportController extends Controller
|
||||
$reachableScopes = $this->get('chill.main.security.authorization.helper')
|
||||
->getReachableScopes($this->getUser(), new Role('CHILL_REPORT_SEE'),
|
||||
$person->getCenter());
|
||||
$reports = $em->getRepository('ChillReportBundle:Report')
|
||||
->findBy(array('person' => $person, 'scope' => $reachableScopes));
|
||||
|
||||
|
||||
$total = $em
|
||||
->createQuery("SELECT COUNT(r.id) FROM ChillReportBundle:Report r "
|
||||
. "WHERE r.person = :person AND r.scope IN (:scopes) ")
|
||||
->setParameter('person', $person)
|
||||
->setParameter('scopes', $reachableScopes)
|
||||
->getSingleScalarResult();
|
||||
|
||||
// get the PaginatorFactory
|
||||
$paginator = $this->get('chill_main.paginator_factory')->create($total);
|
||||
|
||||
$reports = $em->createQuery('SELECT r
|
||||
FROM ChillReportBundle:Report r
|
||||
WHERE r.person = :person AND r.scope IN (:scopes)
|
||||
ORDER BY r.date DESC')
|
||||
->setParameter('person', $person)
|
||||
->setParameter('scopes', $reachableScopes)
|
||||
->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber())
|
||||
->setMaxResults($paginator->getItemsPerPage())
|
||||
->getResult()
|
||||
;
|
||||
|
||||
return $this->render('ChillReportBundle:Report:list.html.twig', array(
|
||||
'reports' => $reports,
|
||||
'person' => $person
|
||||
'reports' => $reports,
|
||||
'person' => $person,
|
||||
'paginator' => $paginator
|
||||
));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user