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);
 }
 public function handle(UpdateOptionValueCommand $command)
 {
     $optionValueDTO = $command->getOptionValueDTO();
     $optionValue = $this->optionService->getOptionValueById($optionValueDTO->id);
     OptionValueDTOBuilder::setFromDTO($optionValue, $optionValueDTO);
     $this->optionService->updateOptionValue($optionValue);
 }
 public function handle(UpdateOptionCommand $command)
 {
     $optionDTO = $command->getOptionDTO();
     $option = $this->optionService->findOneById($optionDTO->id);
     OptionDTOBuilder::setFromDTO($option, $optionDTO);
     $this->optionService->update($option);
 }
 public function handle(CreateTextOptionCommand $command)
 {
     $textOption = new TextOption($command->getTextOptionId());
     $textOption->setName($command->getName());
     $textOption->setDescription($command->getDescription());
     $textOption->setSortOrder($command->getSortOrder());
     $textOption->setType($command->getTextOptionType());
     $this->optionService->createTextOption($textOption);
 }
 public function handle(ListOptionsQuery $query)
 {
     $paginationDTO = $query->getRequest()->getPaginationDTO();
     $pagination = new Pagination($paginationDTO->maxResults, $paginationDTO->page);
     $options = $this->optionService->getAllOptions($query->getRequest()->getQueryString(), $pagination);
     $query->getResponse()->setPaginationDTOBuilder($this->dtoBuilderFactory->getPaginationDTOBuilder($pagination));
     foreach ($options as $option) {
         $query->getResponse()->addOptionDTOBuilder($this->dtoBuilderFactory->getOptionDTOBuilder($option));
     }
 }
 public function handle(CreateOptionValueCommand $command)
 {
     $option = $this->optionService->findOneById($command->getOptionId());
     $optionValue = OptionValueDTOBuilder::createFromDTO($option, $command->getOptionValueDTO());
     $this->optionService->createOptionValue($optionValue);
 }
 public function handle(DeleteOptionProductCommand $command)
 {
     $optionProduct = $this->optionService->getOptionProductById($command->getOptionProductId());
     $this->optionService->deleteOptionProduct($optionProduct);
 }
 public function handle(DeleteOptionCommand $command)
 {
     $option = $this->optionService->findOneById($command->getOptionId());
     $this->optionService->delete($option);
 }
 public function handle(CreateOptionCommand $command)
 {
     $option = OptionDTOBuilder::createFromDTO($command->getOptionId(), $command->getOptionDTO());
     $this->optionService->create($option);
 }
 public function handle(GetOptionQuery $query)
 {
     $product = $this->optionService->findOneById($query->getRequest()->getOptionId());
     $query->getResponse()->setOptionDTOBuilder($this->dtoBuilderFactory->getOptionDTOBuilder($product));
 }
 public function handle(DeleteOptionValueCommand $command)
 {
     $optionValue = $this->optionService->getOptionValueById($command->getOptionValueId());
     $this->optionService->deleteOptionValue($optionValue);
 }