public function execute()
 {
     $document = new DocumentFactory();
     $carDocument = $document->create(DocumentFactory::CAR_DOCUMENT, $this->preparedDocument->docId, $this->preparedDocument->title, $this->preparedDocument->description, $this->preparedDocument->source);
     $car = $this->repository->find($this->carId);
     $car->addCarDocument($carDocument);
     $this->repository->add($car);
 }
 public static function addWithFile(CarInMemoryRepository $repository, $carId, InsuranceDTO $insuranceDTO, DocumentDTO $documentDTO)
 {
     $command = new self();
     $carInsuranceDocument = new DocumentFactory();
     $command->repository = $repository;
     $command->insuranceDTO = $insuranceDTO;
     $command->documentDTO = $documentDTO;
     $command->car = $command->repository->find($carId);
     $command->documentFile = $carInsuranceDocument->create(DocumentFactory::INSURANCE_DOCUMENT, $command->documentDTO->docId, $command->documentDTO->title, $documentDTO->description, $documentDTO->source);
     return $command;
 }
示例#3
0
 /**
  * @throws \Madkom\RegistryApplication\Domain\CarManagement\CarExceptions\EmptyDocumentTypeException
  * @throws \Madkom\RegistryApplication\Domain\CarManagement\CarExceptions\UnknownDocumentTypeException
  *
  * @return \Madkom\RegistryApplication\Domain\CarManagement\CarDocument|\Madkom\RegistryApplication\Domain\CarManagement\Insurances\InsuranceDocument
  */
 private function prepareDocument($docId, $title, $description, $source)
 {
     $carDocument = new DocumentFactory();
     $document = $carDocument->create(DocumentFactory::CAR_DOCUMENT, $docId, $title, $description, $source);
     return $document;
 }