コード例 #1
0
 /**
  * @param UuidInterface $productId
  * @param UuidInterface $tagId
  * @throws EntityNotFoundException
  */
 public function removeTag(UuidInterface $productId, UuidInterface $tagId)
 {
     $product = $this->productRepository->findOneById($productId);
     $tag = $this->tagRepository->findOneById($tagId);
     $product->removeTag($tag);
     $this->productRepository->update($product);
 }
コード例 #2
0
 public function testCreateImageForTag()
 {
     $uploadFileDTO = $this->dummyData->getUploadFileDTO();
     $managedFile = $this->dummyData->getLocalManagedFile();
     $this->fileManager->shouldReceive('saveFile')->with($uploadFileDTO->getFilePath())->once()->andReturn($managedFile);
     $tag = $this->dummyData->getProduct();
     $this->tagRepository->shouldReceive('findOneById')->with($tag->getId())->andReturn($tag)->once();
     $this->imageRepository->shouldReceive('create')->once();
     $this->imageService->createImageForTag($uploadFileDTO, $tag->getId());
 }
コード例 #3
0
 public function createImageForTag(UploadFileDTO $uploadFileDTO, UuidInterface $tagId)
 {
     $managedFile = $this->fileManager->saveFile($uploadFileDTO->getFilePath());
     $image = new Image();
     $image->setPath($managedFile->getUri());
     $image->setWidth($managedFile->getWidth());
     $image->setHeight($managedFile->getHeight());
     $tag = $this->tagRepository->findOneById($tagId);
     $tag->addImage($image);
     $this->create($image);
 }
コード例 #4
0
 public function testRemoveTag()
 {
     $tag = $this->dummyData->getTag();
     $product = $this->dummyData->getProduct();
     $product->addTag($tag);
     $this->productRepository->shouldReceive('findOneById')->andReturn($product);
     $this->tagRepository->shouldReceive('findOneById')->andReturn($tag);
     $this->productRepository->shouldReceive('update')->once();
     $this->productService->removeTag($product->getId(), $tag->getId());
     $this->assertCount(0, $product->getTags());
 }
コード例 #5
0
 public function testRemoveOption()
 {
     $tag1 = $this->dummyData->getTag();
     $this->tagRepository->shouldReceive('findOneById')->with($tag1->getId())->andReturn($tag1)->once();
     $option1 = $this->dummyData->getOption();
     $this->optionRepository->shouldReceive('findOneById')->with($option1->getId())->andReturn($option1)->once();
     $this->tagRepository->shouldReceive('update')->once();
     $this->tagService->removeOption($tag1->getId(), $option1->getId());
 }
コード例 #6
0
ファイル: TagService.php プロジェクト: inklabs/kommerce-core
 public function getAllTagsByIds($tagIds, Pagination &$pagination = null)
 {
     return $this->tagRepository->getAllTagsByIds($tagIds, $pagination);
 }