src/Entity/Albums.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\AlbumsRepository")
  8.  */
  9. class Albums
  10. {
  11.     private $dir 'upload/images/albums';
  12.     private $thumbnailDir 'upload/thumbnails/albums';
  13.     private $validsMimetypes = [];
  14.     /**
  15.      * Constructor
  16.      */
  17.     public function __construct()
  18.     {
  19.         $this->pictures = new \Doctrine\Common\Collections\ArrayCollection();
  20.     }
  21.     public function getDir(): ?string
  22.     {
  23.         return $this->dir;
  24.     }
  25.     public function setDir(?string $dir): self
  26.     {
  27.         $this->dir $dir;
  28.         return $this;
  29.     }
  30.     public function setValidsMimetypes(?array $mimetypes): self
  31.     {
  32.         $this->validsMimetypes $mimetypes;
  33.         return $this;
  34.     }
  35.     public function getValidsMimetypes(): ?array
  36.     {
  37.         return $this->validsMimetypes;
  38.     }
  39.     /**
  40.      * @var int
  41.      *
  42.      * @ORM\Column(name="id", type="integer")
  43.      * @ORM\Id
  44.      * @ORM\GeneratedValue(strategy="AUTO")
  45.      */
  46.     private $id;
  47.     /**
  48.      * @var string
  49.      *
  50.      * @ORM\Column(name="title", type="string", length=255, nullable=true)
  51.      */
  52.     private $title;
  53.     /**
  54.      * @ORM\Column(name="isEnabled",type="boolean", nullable=true)
  55.      */
  56.     private $isEnabled;
  57.     /**
  58.      * @ORM\ManyToMany(targetEntity=Picture::class, cascade={"persist","remove"})
  59.      */
  60.     private $pictures;
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getTitle(): ?string
  66.     {
  67.         return $this->title;
  68.     }
  69.     public function setTitle(?string $title): self
  70.     {
  71.         $this->title $title;
  72.         return $this;
  73.     }
  74.     public function getIsEnabled(): ?bool
  75.     {
  76.         return $this->isEnabled;
  77.     }
  78.     public function setIsEnabled(?bool $isEnabled): self
  79.     {
  80.         $this->isEnabled $isEnabled;
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection|Picture[]
  85.      */
  86.     public function getPictures(): Collection
  87.     {
  88.         return $this->pictures;
  89.     }
  90.     public function addPicture(Picture $picture): self
  91.     {
  92.         if ($picture && !$this->pictures->contains($picture)) {
  93.             $picture->setDir($this->dir);
  94.             $picture->setThumbnailDir($this->thumbnailDir);
  95.             $this->pictures[] = $picture;
  96.         }
  97.         return $this;
  98.     }
  99.     public function removePicture(Picture $picture): self
  100.     {
  101.         $this->pictures->removeElement($picture);
  102.         return $this;
  103.     }
  104. }