/** * action delete * * @param Reservation $reservation * @return void */ public function deleteAction(Reservation $reservation) { $this->addFlashMessage($this->translate('message.reservation.delete.success')); if ($participants = $reservation->getParticipants()) { foreach ($participants as $participant) { $reservation->getLesson()->removeParticipant($participant); $this->personRepository->remove($participant); } } if ($company = $reservation->getCompany()) { $this->companyRepository->remove($company); } if ($contact = $reservation->getContact()) { $this->personRepository->remove($contact); } $this->reservationRepository->remove($reservation); $this->redirect('list'); }
/** * @test */ public function getCompanyReturnsInitialValueForCompany() { $this->assertEquals(NULL, $this->subject->getCompany()); }