/**
  * @test
  */
 public function setLessonForLessonSetsLesson()
 {
     $lesson = new Performance();
     $this->subject->setLesson($lesson);
     $this->assertSame($lesson, $this->subject->getLesson());
 }
 /**
  * action removeParticipant
  *
  * @param Reservation $reservation
  * @param Person $participant
  * @param string $reason Reason for cancellation of reservation for this participant. Allowed:  'byOrganizer', 'withCosts', 'withoutCost'
  * @return void
  */
 public function removeParticipantAction(Reservation $reservation, Person $participant, $reason)
 {
     $reservation->removeParticipant($participant);
     $reservation->getLesson()->removeParticipant($participant);
     $this->personRepository->remove($participant);
     $this->addFlashMessage($this->translate('message.reservation.removeParticipant.success'));
     if ($this->settings['bookings']['removeParticipant'][$reason]['confirm']['sendNotification']) {
         /**@var Notification $notification * */
         $notification = $this->objectManager->get(Notification::class);
         $bodytext = $this->notificationService->render($this->settings['bookings']['removeParticipant'][$reason]['confirm']['templateFileName'], 'html', 'Bookings/Email/RemoveParticipant', ['reservation' => $reservation, 'participant' => $participant, 'reason' => $reason, 'baseUrl' => $this->getBaseUrlForFrontend()]);
         $notification->setRecipient($reservation->getContact()->getEmail());
         $notification->setBodytext($bodytext);
         $notification->setSubject($this->settings['bookings']['removeParticipant'][$reason]['confirm']['subject']);
         $notification->setSender($this->settings['bookings']['removeParticipant'][$reason]['confirm']['fromEmail']);
         $notification->setReservation($reservation);
         $notificationSuccess = $this->notificationService->send($notification);
         if ($notificationSuccess) {
             $mailMessageKey = 'message.bookings.cancel.sendNotification.success';
             $mailMessageSeverity = AbstractMessage::OK;
             $notification->setSentAt(new \DateTime());
         } else {
             $mailMessageKey = 'message.bookings.cancel.sendNotification.error';
             $mailMessageSeverity = AbstractMessage::WARNING;
         }
         $this->notificationRepository->add($notification);
         $this->persistenceManager->persistAll();
         $reservation->addNotification($notification);
         $this->addFlashMessage($this->translate($mailMessageKey), null, $mailMessageSeverity);
     }
     $this->redirect('edit', null, null, ['reservation' => $reservation]);
 }
 /**
  * action removeParticipant
  *
  * @param Reservation $reservation
  * @param Person $participant
  * @return void
  */
 public function removeParticipantAction(Reservation $reservation, Person $participant)
 {
     $reservation->removeParticipant($participant);
     $reservation->getLesson()->removeParticipant($participant);
     $this->personRepository->remove($participant);
     $this->reservationRepository->update($reservation);
     $this->addFlashMessage($this->translate('message.reservation.removeParticipant.success'));
     $this->redirect('edit', null, null, ['reservation' => $reservation]);
 }