src/Entity/TypeDocument.php line 14

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. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\TypeDocumentRepository")
  9.  * @UniqueEntity("type")
  10.  */
  11. class TypeDocument
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255,unique=true)
  21.      */
  22.     private $type;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $slug;
  27.     /**
  28.      * @return mixed
  29.      */
  30.     public function getSlug()
  31.     {
  32.         return $this->slug;
  33.     }
  34.     /**
  35.      * @param mixed $slug
  36.      */
  37.     public function setSlug($slug): void
  38.     {
  39.         $this->slug $slug;
  40.     }
  41.     /**
  42.      * @ORM\OneToMany(targetEntity="App\Entity\Media", mappedBy="typeDocument")
  43.      */
  44.     private $typedocument;
  45.     public function __construct()
  46.     {
  47.         $this->typedocument = new ArrayCollection();
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getType(): ?string
  54.     {
  55.         return $this->type;
  56.     }
  57.     public function setType(string $type): self
  58.     {
  59.         $this->type $type;
  60.         return $this;
  61.     }
  62.     /**
  63.      * @return Collection|Media[]
  64.      */
  65.     public function getTypedocument(): Collection
  66.     {
  67.         return $this->typedocument;
  68.     }
  69.     public function addTypedocument(Media $typedocument): self
  70.     {
  71.         if (!$this->typedocument->contains($typedocument)) {
  72.             $this->typedocument[] = $typedocument;
  73.             $typedocument->setTypeDocument($this);
  74.         }
  75.         return $this;
  76.     }
  77.     public function removeTypedocument(Media $typedocument): self
  78.     {
  79.         if ($this->typedocument->contains($typedocument)) {
  80.             $this->typedocument->removeElement($typedocument);
  81.             // set the owning side to null (unless already changed)
  82.             if ($typedocument->getTypeDocument() === $this) {
  83.                 $typedocument->setTypeDocument(null);
  84.             }
  85.         }
  86.         return $this;
  87.     } public function __toString()
  88. {
  89.     return $this->getType();
  90.     }
  91. }