public function handle(ListCatalogPromotionsQuery $query)
 {
     $paginationDTO = $query->getRequest()->getPaginationDTO();
     $pagination = new Pagination($paginationDTO->maxResults, $paginationDTO->page);
     $catalogPromotions = $this->catalogPromotionService->getAllCatalogPromotions($query->getRequest()->getQueryString(), $pagination);
     $query->getResponse()->setPaginationDTOBuilder($this->dtoBuilderFactory->getPaginationDTOBuilder($pagination));
     foreach ($catalogPromotions as $catalogPromotion) {
         $query->getResponse()->addCatalogPromotionDTOBuilder($this->dtoBuilderFactory->getCatalogPromotionDTOBuilder($catalogPromotion));
     }
 }
 public function handle(CreateCatalogPromotionCommand $command)
 {
     $catalogPromotion = new CatalogPromotion($command->getCatalogPromotionId());
     $catalogPromotion->setName($command->getName());
     $catalogPromotion->setType(PromotionType::createById($command->getPromotionTypeId()));
     $catalogPromotion->setValue($command->getValue());
     $catalogPromotion->setReducesTaxSubtotal($command->getReducesTaxSubtotal());
     $catalogPromotion->setMaxRedemptions($command->getMaxRedemptions());
     $catalogPromotion->setStart($command->getStartDate());
     $catalogPromotion->setEnd($command->getEndDate());
     if ($command->getTagId() !== null) {
         $tag = $this->tagService->findOneById($command->getTagId());
         $catalogPromotion->setTag($tag);
     }
     $this->catalogPromotionService->create($catalogPromotion);
 }