src/Entity/Biblios.php line 12

  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\BibliosRepository")
  8.  */
  9. class Biblios
  10. {
  11.     private $dir 'upload/files/biblios/';
  12.     private $validsMimetypes = [];
  13.     public function __construct()
  14.     {
  15.         // $this->documents = new \Doctrine\Common\Collections\ArrayCollection();
  16.         $this->validsMimetypes;
  17.         $this->files = new ArrayCollection();
  18.     }
  19.     public function getDir(): ?string
  20.     {
  21.         return $this->dir;
  22.     }
  23.     public function setDir(?string $dir): self
  24.     {
  25.         $this->dir $dir;
  26.         return $this;
  27.     }
  28.     public function setValidsMimetypes(?array $mimetypes): self
  29.     {
  30.         $this->validsMimetypes $mimetypes;
  31.         return $this;
  32.     }
  33.     public function getValidsMimetypes(): ?array
  34.     {
  35.         return $this->validsMimetypes;
  36.     }
  37.     /**
  38.      * @ORM\Column(name="id", type="integer")
  39.      * @ORM\Id
  40.      * @ORM\GeneratedValue(strategy="AUTO")
  41.      */
  42.     private $id;
  43.     /**
  44.      * @ORM\Column(name="title", type="string", length=255, nullable=true)
  45.      */
  46.     private $title;
  47.     /**
  48.      * @ORM\Column(name="isEnabled",type="boolean", nullable=true)
  49.      */
  50.     private $isEnabled;
  51.     /**
  52.      * @ORM\ManyToMany(targetEntity=File::class, cascade={"persist","remove"})
  53.      */
  54.     private $files;
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getTitle(): ?string
  60.     {
  61.         return $this->title;
  62.     }
  63.     public function setTitle(?string $title): self
  64.     {
  65.         $this->title $title;
  66.         return $this;
  67.     }
  68.     public function getIsEnabled(): ?bool
  69.     {
  70.         return $this->isEnabled;
  71.     }
  72.     public function setIsEnabled(?bool $isEnabled): self
  73.     {
  74.         $this->isEnabled $isEnabled;
  75.         return $this;
  76.     }
  77.     /**
  78.      * @return Collection|File[]
  79.      */
  80.     public function getFiles(): Collection
  81.     {
  82.         return $this->files;
  83.     }
  84.     public function addFile(File $file): self
  85.     {
  86.         if ($file && !$this->files->contains($file)) {
  87.             $file->setDir($this->getDir());
  88.             $this->files[] = $file;
  89.         }
  90.         return $this;
  91.     }
  92.     public function removeFile(File $file): self
  93.     {
  94.         $this->files->removeElement($file);
  95.         return $this;
  96.     }
  97. }