getUser(); $teamer = $user->getTeamer(); $assignment = $disposition->getAssignment(); $destination = $assignment->getDestination(); $jobProfile = $assignment->getJobProfile(); $ics = (new IcsGenerator($disposition))->generate(); $filename = sprintf( 'Einteilung_%s_%s-%s.ics', $jobProfile->getName(), $destination->getDateFrom()->format('d.m.Y'), $destination->getDateTo()->format('d.m.Y') ); $slugger = new AsciiSlugger(); $filename = $slugger->slug($filename); $contentDisposition = HeaderUtils::makeDisposition( HeaderUtils::DISPOSITION_INLINE, $filename, md5($filename) ); $response = new Response($ics); $response->setPrivate(); $response->headers->set('Content-type', 'text/calendar'); $response->headers->set('Content-Disposition', $contentDisposition); $this->logger->info('Create ICS file', [ 'assignment_id' => $assignment->getId(), 'destination' => (string) $destination, 'teamer_id' => $teamer->getId(), 'teamer_name' => (string) $teamer, ]); return $response; } }