コード例 #1
0
 public function __construct(Tag $tag, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $tag;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = $this->getEntityDTO();
     $this->setId();
     $this->setTime();
     $this->entityDTO->slug = Slug::get($this->entity->getName());
     $this->entityDTO->name = $this->entity->getName();
     $this->entityDTO->code = $this->entity->getCode();
     $this->entityDTO->description = $this->entity->getDescription();
     $this->entityDTO->defaultImage = $this->entity->getDefaultImage();
     $this->entityDTO->sortOrder = $this->entity->getSortOrder();
     $this->entityDTO->isVisible = $this->entity->isVisible();
     $this->entityDTO->isActive = $this->entity->isActive();
     $this->entityDTO->areAttachmentsEnabled = $this->entity->areAttachmentsEnabled();
 }
コード例 #2
0
ファイル: TagTest.php プロジェクト: inklabs/kommerce-core
 public function testCreateDefaults()
 {
     $tag = new Tag();
     $this->assertTrue($tag->getId() instanceof UuidInterface);
     $this->assertTrue($tag->getCreated() instanceof DateTime);
     $this->assertSame(null, $tag->getUpdated());
     $this->assertSame(null, $tag->getName());
     $this->assertSame(null, $tag->getCode());
     $this->assertSame(null, $tag->getDescription());
     $this->assertSame(null, $tag->getDefaultImage());
     $this->assertSame(false, $tag->isActive());
     $this->assertSame(false, $tag->isVisible());
     $this->assertSame(false, $tag->areAttachmentsEnabled());
     $this->assertSame(0, $tag->getSortOrder());
     $this->assertSame(0, count($tag->getProducts()));
     $this->assertSame(0, count($tag->getImages()));
     $this->assertSame(0, count($tag->getOptions()));
     $this->assertSame(0, count($tag->getTextOptions()));
 }