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); }