public function __construct(Image $image, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $image;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = new ImageDTO();
     $this->setId();
     $this->setTime();
     $this->entityDTO->path = $this->entity->getPath();
     $this->entityDTO->width = $this->entity->getWidth();
     $this->entityDTO->height = $this->entity->getHeight();
     $this->entityDTO->sortOrder = $this->entity->getSortOrder();
 }
Beispiel #2
0
 public function addImage(Image $image)
 {
     if ($this->images->isEmpty()) {
         $this->setDefaultImage($image->getPath());
     }
     $image->setTag($this);
     $this->images->add($image);
 }
Beispiel #3
0
 public function testCreateDefaults()
 {
     $image = new Image();
     $this->assertSame(null, $image->getPath());
     $this->assertSame(null, $image->getWidth());
     $this->assertSame(null, $image->getHeight());
     $this->assertSame(0, $image->getSortOrder());
     $this->assertSame(null, $image->getProduct());
     $this->assertSame(null, $image->getTag());
 }