public function handle(UpdateOptionProductCommand $command) { $optionProductDTO = $command->getOptionProductDTO(); $optionProduct = $this->optionService->getOptionProductById($optionProductDTO->id); OptionProductDTOBuilder::setFromDTO($optionProduct, $optionProductDTO); $this->optionService->updateOptionProduct($optionProduct); }
public function handle(CreateOptionProductCommand $command) { $option = $this->optionService->findOneById($command->getOptionId()); $product = $this->productService->findOneById($command->getProductId()); $optionProduct = OptionProductDTOBuilder::createFromDTO($option, $product, $command->getOptionProductDTO()); $this->optionService->createOptionProduct($optionProduct); }