/** * @test */ public function removeBillingAddressSetsBillingAddressToNull() { $this->subject->setBillingAddress(new BillingAddress()); $this->subject->removeBillingAddress(); $this->assertNull($this->subject->getBillingAddress()); }
/** * Removes a billing address from reservation * * @param Reservation $reservation * @throws InvalidSourceException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException */ public function removeBillingAddressAction(Reservation $reservation) { if ($billingAddress = $reservation->getBillingAddress()) { $reservation->removeBillingAddress(); $this->billingAddressRepository->remove($billingAddress); $this->addFlashMessage($this->translate('message.reservation.removeBillingAddress.success')); } $this->redirect('edit', null, null, ['reservation' => $reservation]); }