src/Entity/Media/DocumentType.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Media;
  3. use App\Entity\Site\AccessSite;
  4. use App\Entity\Site\Site;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use App\Entity\Federation\Race;
  11. use Gedmo\Translatable\Translatable;
  12. /**
  13.  * @ORM\Entity(repositoryClass="App\Repository\Media\DocumentTypeRepository")
  14.  * @ORM\Table(name="documents_types")
  15.  * @Gedmo\TranslationEntity(class="App\Entity\Translation\DocumentTypeTranslation")
  16.  */
  17. class DocumentType
  18. {
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\Column(type="integer")
  22.      * @ORM\GeneratedValue(strategy="AUTO")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      * @Assert\NotBlank()
  28.      * @Gedmo\Translatable
  29.      */
  30.     #[Gedmo\Translatable]
  31.     private $name;
  32.     
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      */
  36.     private $icon;
  37.     /**
  38.      * @ORM\Column(type="string", length=255, nullable=true)
  39.      * @Assert\NotBlank()
  40.      */
  41.     private $directoryName;
  42.     /**
  43.      * @ORM\Column(type="datetime", nullable=false, name="created_date")
  44.      * @Gedmo\Timestampable(on="create")
  45.      */
  46.     private $createdDate;
  47.     /**
  48.      * @ORM\Column(type="datetime", nullable=true, name="updated_date")
  49.      * @Gedmo\Timestampable(on="update")
  50.      */
  51.     private $updatedDate;
  52.     /**
  53.      * @ORM\Column(type="integer", nullable=false, name="status")
  54.      */
  55.     private $status 1;
  56.     /**
  57.      * @ORM\OneToMany(targetEntity="App\Entity\Media\Document", mappedBy="documentType")
  58.      */
  59.     private $documents;
  60.     /**
  61.      * @ORM\OneToMany(targetEntity="App\Entity\Media\Category", mappedBy="documentType")
  62.      */
  63.     private $categories;
  64.     /**
  65.      * @ORM\ManyToMany(targetEntity="App\Entity\Federation\Race", inversedBy="documentTypes")
  66.      * @ORM\JoinTable(
  67.      *     name="races_document_types",
  68.      *     joinColumns={@ORM\JoinColumn(name="document_type_id", referencedColumnName="id", nullable=false)},
  69.      *     inverseJoinColumns={@ORM\JoinColumn(name="race_id", referencedColumnName="id", nullable=false)}
  70.      * )
  71.      */
  72.     private $races;
  73.     /**
  74.      * @ORM\ManyToMany(targetEntity="App\Entity\Site\AccessSite", mappedBy="documentTypes")
  75.      */
  76.     private $accessSites;
  77.     
  78.     /**
  79.      * @Gedmo\Locale
  80.      */
  81.     private $locale;
  82.     public function __construct()
  83.     {
  84.         $this->documents = new ArrayCollection();
  85.         $this->categories = new ArrayCollection();
  86.         $this->races = new ArrayCollection();
  87.         $this->accessSites = new ArrayCollection();
  88.     }
  89.     public function getId(): ?int
  90.     {
  91.         return $this->id;
  92.     }
  93.     public function getName(): ?string
  94.     {
  95.         return $this->name;
  96.     }
  97.     public function setName(?string $name): self
  98.     {
  99.         $this->name $name;
  100.         return $this;
  101.     }
  102.     
  103.     public function getIcon(): ?string
  104.     {
  105.         return $this->icon;
  106.     }
  107.     
  108.     public function setIcon(?string $icon): self
  109.     {
  110.         $this->icon $icon;
  111.         
  112.         return $this;
  113.     }
  114.     public function getDirectoryName(): ?string
  115.     {
  116.         return $this->directoryName;
  117.     }
  118.     public function setDirectoryName(?string $directoryName): self
  119.     {
  120.         $this->directoryName $directoryName;
  121.         return $this;
  122.     }
  123.     public function getCreatedDate(): ?\DateTimeInterface
  124.     {
  125.         return $this->createdDate;
  126.     }
  127.     public function getUpdatedDate(): ?\DateTimeInterface
  128.     {
  129.         return $this->updatedDate;
  130.     }
  131.     public function getStatus(): ?int
  132.     {
  133.         return $this->status;
  134.     }
  135.     public function setStatus(int $status): self
  136.     {
  137.         $this->status $status;
  138.         return $this;
  139.     }
  140.     /**
  141.      * @return Collection|Document[]
  142.      */
  143.     public function getDocuments(): Collection
  144.     {
  145.         return $this->documents;
  146.     }
  147.     public function addDocument(Document $document): self
  148.     {
  149.         if (!$this->documents->contains($document)) {
  150.             $this->documents[] = $document;
  151.             $document->setDocumentType($this);
  152.         }
  153.         return $this;
  154.     }
  155.     public function removeDocument(Document $document): self
  156.     {
  157.         if ($this->documents->contains($document)) {
  158.             $this->documents->removeElement($document);
  159.             // set the owning side to null (unless already changed)
  160.             if ($document->getDocumentType() === $this) {
  161.                 $document->setDocumentType(null);
  162.             }
  163.         }
  164.         return $this;
  165.     }
  166.     /**
  167.      * @return Collection|Category[]
  168.      */
  169.     public function getCategories(): Collection
  170.     {
  171.         return $this->categories;
  172.     }
  173.     public function addCategory(Category $category): self
  174.     {
  175.         if (!$this->categories->contains($category)) {
  176.             $this->categories[] = $category;
  177.             $category->setDocumentType($this);
  178.         }
  179.         return $this;
  180.     }
  181.     public function removeCategory(Category $category): self
  182.     {
  183.         if ($this->categories->contains($category)) {
  184.             $this->categories->removeElement($category);
  185.             // set the owning side to null (unless already changed)
  186.             if ($category->getDocumentType() === $this) {
  187.                 $category->setDocumentType(null);
  188.             }
  189.         }
  190.         return $this;
  191.     }
  192.     /**
  193.      * @return Collection|Race[]
  194.      */
  195.     public function getRaces(): Collection
  196.     {
  197.         return $this->races;
  198.     }
  199.     public function addRace(Race $race): self
  200.     {
  201.         if (!$this->races->contains($race)) {
  202.             $this->races[] = $race;
  203.         }
  204.         return $this;
  205.     }
  206.     public function removeRace(Race $race): self
  207.     {
  208.         if ($this->races->contains($race)) {
  209.             $this->races->removeElement($race);
  210.         }
  211.         return $this;
  212.     }
  213.     /**
  214.      * @return Collection|DocumentType[]
  215.      */
  216.     public function getAccessSites(): Collection
  217.     {
  218.         return $this->accessSites;
  219.     }
  220.     public function addAccessSite(DocumentType $accessSite): self
  221.     {
  222.         if (!$this->accessSites->contains($accessSite)) {
  223.             $this->accessSites[] = $accessSite;
  224.             $accessSite->addAccessSite($this);
  225.         }
  226.         return $this;
  227.     }
  228.     public function removeAccessSite(DocumentType $accessSite): self
  229.     {
  230.         if ($this->accessSites->contains($accessSite)) {
  231.             $this->accessSites->removeElement($accessSite);
  232.             $accessSite->removeAccessSite($this);
  233.         }
  234.         return $this;
  235.     }
  236.     
  237.     public function setTranslatableLocale($locale)
  238.     {
  239.         $this->locale $locale;
  240.     }
  241. }