src/Entity/ItemPhoto.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\CommonTrait;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\ItemPhotoRepository")
  8.  * @ORM\Table(name="itm_photo")
  9.  * @ORM\HasLifecycleCallbacks()
  10.  * @UniqueEntity({"uuid"})
  11.  */
  12. class ItemPhoto
  13. {
  14.     use CommonTrait;
  15.     /**
  16.      * @ORM\Column(type="string", length=255, nullable=true)
  17.      */
  18.     private $name;
  19.     /**
  20.      * @ORM\ManyToOne(targetEntity="App\Entity\Item", inversedBy="itemPhotos")
  21.      * @ORM\JoinColumn(nullable=false)
  22.      */
  23.     private $item;
  24.     /**
  25.      * @ORM\Column(type="integer", nullable=true)
  26.      */
  27.     private $photoOrder;
  28.     /**
  29.      * @ORM\OneToOne(targetEntity="App\Entity\File", cascade={"persist", "remove"})
  30.      * @ORM\JoinColumn(nullable=false)
  31.      */
  32.     private $file;
  33.     public function __toString()
  34.     {
  35.         return $this->getName();
  36.     }
  37.     public function getName(): ?string
  38.     {
  39.         return $this->name;
  40.     }
  41.     public function setName(?string $name): self
  42.     {
  43.         $this->name $name;
  44.         return $this;
  45.     }
  46.     public function getItem(): ?Item
  47.     {
  48.         return $this->item;
  49.     }
  50.     public function setItem(?Item $item): self
  51.     {
  52.         $this->item $item;
  53.         return $this;
  54.     }
  55.     public function getPhotoOrder(): ?int
  56.     {
  57.         return $this->photoOrder;
  58.     }
  59.     public function setPhotoOrder(?int $photoOrder): self
  60.     {
  61.         $this->photoOrder $photoOrder;
  62.         return $this;
  63.     }
  64.     public function getFile(): ?File
  65.     {
  66.         return $this->file;
  67.     }
  68.     public function setFile(File $file): self
  69.     {
  70.         $this->file $file;
  71.         return $this;
  72.     }
  73. }