<?php
namespace App\Entity;
use App\Entity\Traits\CommonTrait;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ItemPhotoRepository")
* @ORM\Table(name="itm_photo")
* @ORM\HasLifecycleCallbacks()
* @UniqueEntity({"uuid"})
*/
class ItemPhoto
{
use CommonTrait;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Item", inversedBy="itemPhotos")
* @ORM\JoinColumn(nullable=false)
*/
private $item;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $photoOrder;
/**
* @ORM\OneToOne(targetEntity="App\Entity\File", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
private $file;
public function __toString()
{
return $this->getName();
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getItem(): ?Item
{
return $this->item;
}
public function setItem(?Item $item): self
{
$this->item = $item;
return $this;
}
public function getPhotoOrder(): ?int
{
return $this->photoOrder;
}
public function setPhotoOrder(?int $photoOrder): self
{
$this->photoOrder = $photoOrder;
return $this;
}
public function getFile(): ?File
{
return $this->file;
}
public function setFile(File $file): self
{
$this->file = $file;
return $this;
}
}