public function handle(UpdateTagCommand $command) { $tagDTO = $command->getTagDTO(); $tag = $this->tagService->findOneById($tagDTO->id); TagDTOBuilder::setFromDTO($tag, $tagDTO); $this->tagService->update($tag); }
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); }
public function handle(GetTagQuery $query) { $tag = $this->tagService->findOneById($query->getRequest()->getTagId()); $query->getResponse()->setTagDTOBuilder($this->dtoBuilderFactory->getTagDTOBuilder($tag)); }
public function handle(DeleteTagCommand $command) { $tag = $this->tagService->findOneById($command->getTagId()); $this->tagService->delete($tag); }