/**
  * @return static
  */
 public function withTags()
 {
     foreach ($this->entity->getTags() as $tag) {
         $this->entityDTO->tags[] = $this->dtoBuilderFactory->getTagDTOBuilder($tag)->build();
     }
     return $this;
 }
 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);
 }
Пример #3
0
 public function testCreate()
 {
     $textOptionType = $this->dummyData->getTextOptionType();
     $tag = $this->dummyData->getTag();
     $textOption = new TextOption();
     $textOption->setType($textOptionType);
     $textOption->setName('Custom Message');
     $textOption->setDescription('Custom engraved message');
     $textOption->setSortOrder(2);
     $textOption->addTag($tag);
     $this->assertEntityValid($textOption);
     $this->assertSame($textOptionType, $textOption->getType());
     $this->assertSame('Custom Message', $textOption->getName());
     $this->assertSame('Custom engraved message', $textOption->getDescription());
     $this->assertSame(2, $textOption->getSortOrder());
     $this->assertSame($tag, $textOption->getTags()[0]);
 }
Пример #4
0
 public function getTextOption()
 {
     $textOption = new TextOption();
     $textOption->setName('Size');
     $textOption->setType($this->getTextOptionType());
     $textOption->setDescription('Shirt Size');
     $textOption->setSortOrder(0);
     return $textOption;
 }
Пример #5
0
 public function addTextOption(TextOption $textOption)
 {
     $textOption->addTag($this);
     $this->textOptions[] = $textOption;
 }