getResource(); $this->send( $resource->getType(), \sprintf('Neue Buchung: %s am %s', $resource->getLabel(), $booking->getDate()->format('d.m.Y')), 'email/booking_created', ['booking' => $booking], ); } /** * One mail for a whole series, not one per occurrence. * * A year of weekly bookings is the same act and would otherwise arrive as fifty-two mails in * one second -- the same reason AuditLogger records a series once rather than per day. */ public function seriesCreated(SeriesResult $result): void { if ($result->isCompletelyBlocked()) { return; } $series = $result->series; $resource = $series->getResource(); $this->send( $resource->getType(), \sprintf('Neue Serienbuchung: %s ab %s', $resource->getLabel(), $series->getStartDate()->format('d.m.Y')), 'email/series_created', ['result' => $result, 'series' => $series], ); } /** * @param array $context */ private function send(ResourceType $type, string $subject, string $template, array $context): void { $this->mailer->send($this->settings->recipientsFor($type), $subject, $template, $context); } }