private function custodianRemove(Custodian $custodian) { $id = $custodian->getId(); Custodian::removeCustodian($custodian); $this->init->em->remove($custodian); $this->init->em->flush(); $this->assertEquals(null, $this->init->custodianRepo->find($id)); }
/** * @param Custodian $custodian * @return CustodianListDTO */ public function custodianToCustodianListDTO(Custodian $custodian) { $custodianListDTO = new CustodianListDTO(); $custodianListDTO->id = $custodian->getId(); $custodianListDTO->title = $custodian->getTitle(); $custodianListDTO->firstname = $custodian->getFirstname(); $custodianListDTO->telephone = $custodian->getTelephone(); $custodianListDTO->lastname = $custodian->getLastname(); $custodianListDTO->street = $custodian->getAddress()->getStreet(); $custodianListDTO->city = $custodian->getAddress()->getCity(); return $custodianListDTO; }
/** * @param Custodian $custodian */ public static function removeCustodian(Custodian $custodian) { /** * @var Passenger $p */ foreach ($custodian->passengers as $p) { $p->removeCustodian(null); } $custodian->removePerson(); }