getDateTimeFactory()->createDateTime(), $this->getUser()); $form = $this->createForm(ProjectViewForm::class, $query, [ 'action' => $this->generateUrl('report_project_view') ]); $form->submit($request->query->all(), false); $entries = $service->getProjectView($query); $byCustomer = []; foreach ($entries as $entry) { $customer = $entry->getProject()->getCustomer(); if (!isset($byCustomer[$customer->getId()])) { $byCustomer[$customer->getId()] = ['customer' => $customer, 'projects' => []]; } $byCustomer[$customer->getId()]['projects'][] = $entry; } return $this->render('reporting/project_view.html.twig', [ 'entries' => $byCustomer, 'form' => $form->createView(), ]); } }