Closed romainlaisne closed 7 years ago
Hi @romainlaisne can you share a snippet of you code to look for integration.
Hi @petkopara,
In the controller, I get the total for the current entity:
$queryBuilder = $em->getRepository('XodmpKernelBundle:Contact')->createQueryBuilder('c');
$query = $em->getRepository('XodmpKernelBundle:Contact')->createQueryBuilder('c')->select('COUNT(c.contact_id)')
->getQuery();
$totalOfContacts = $query->getSingleScalarResult();
I pass this to twig:
return $this->render('XodmpKernelBundle:Contact:index.html.twig', array(
'contacts' => $contacts,
'pagerHtml' => $pagerHtml,
'filterForm' => $filterForm->createView(),
'totalOfContacts' => $totalOfContacts,
In the twig template, I show it like this:
<h3>Contact ({{ contacts|length }}/{{ totalOfContacts }})
Added total records label in v3.0.5
Hi @petkopara,
I work together with @pesseyjulien, for the reference ;) We start to use your bundle in one of our project.
I thought it would be nice to have a current / grand total of the records shown on the generated page. For instance, for a list of contact, it would be "List of contacts (20/1450)".
I have done it myself on my setup, but it would be better to have it by default in the output of your generator.
Looking forward to your feedback. Thanks.