private function vehicleRemove(Vehicle $vehicle) { $id = $vehicle->getId(); Vehicle::removeVehicle($vehicle); $this->init->vehicleRepo->remove($vehicle); $this->init->em->flush(); $this->assertEquals(null, $this->init->vehicleRepo->find($id)); }
/** * Assign vehicle to driving pool(s) and mark resource as occupied. * Prerequisite: the vehicle has been tested to be available. * * @param Vehicle $vehicle * @param DispositionResourcesDTO $dto */ protected function assignVehicleToDrivingPools(Vehicle $vehicle, DispositionResourcesDTO $dto) { foreach ($dto->getShifts() as $idx => $shift) { $this->resources[$shift->getId()][$vehicle->getId()] = true; $drivingPool = $dto->getDrivingPools()[$idx]; $drivingPool->assignVehicle($vehicle); } }
/** * @param Vehicle $vehicle * @return VehicleListDTO */ public function toVehicleListDTO(Vehicle $vehicle) { $vehicleListDTO = new VehicleListDTO(); $vehicleListDTO->id = $vehicle->getId(); $vehicleListDTO->name = $vehicle->getName(); $vehicleListDTO->licenceNumber = $vehicle->getLicenceNumber(); $vehicleListDTO->parking = $vehicle->getParking(); $vehicleListDTO->depot = $vehicle->getDepot()->getName(); $vehicleListDTO->dateOfFirstRegistration = $vehicle->getDateOfFirstRegistration()->format('d.m.Y'); $vehicleListDTO->category = $vehicle->getCategory()->getName(); $vehicleListDTO->amountOfSeats = $vehicle->getCategory()->getAmountOfSeats(); $vehicleListDTO->amountOfWheelChairs = $vehicle->getCategory()->getAmountOfWheelChairs(); return $vehicleListDTO; }