/** * @Extra\Route("/announcements/{id}/get-tickets", name="GetAnnouncementTickets") * @Extra\ParamConverter */ public function downloadTicketsAction(Entity\Announcement $announcement) { $file = $this->get("arodiss.xls.builder")->buildXlsFromArray(array_merge([['Имя', 'Количество мест']], $announcement->getTicketsBookedGrouped())); $response = new Response(); $response->headers->set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); $response->headers->set("Content-Disposition", "attachment;filename=tickets.xlsx"); $response->setContent(file_get_contents($file)); return $response; }