public function execute() { $insurance = $this->insuranceDTO; $insuranceFactory = new InsuranceFactory(); $newInsurance = $insuranceFactory->create($insurance->insuranceId, $insurance->type, new \DateTime($insurance->dateFrom), new \DateTime($insurance->dateTo), $insurance->insurerId); $this->car->addInsurance($newInsurance); if ($this->documentFile) { $this->car->addInsuranceDocument($newInsurance->getId(), $this->documentFile); } $this->repository->add($this->car); }
public function add(Car $car) { $this->repository[$car->getId()] = $car; }
public function execute() { $car = Car::createCustom($this->preparedCar->id, $this->preparedCar->responsiblePerson, $this->preparedCar->model, $this->preparedCar->brand, $this->preparedCar->registrationNumber, $this->preparedCar->productionDate, $this->preparedCar->warrantyPeriod, $this->preparedCar->city, $this->preparedCar->department); $this->carRepository->add($car); }