src/Entity/Direction.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DirectionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Uid\Uuid;
  9. /**
  10.  * @ORM\Entity(repositoryClass=DirectionRepository::class)
  11.  * @UniqueEntity(fields={"nom"}, message="Cette direction existe déjà")
  12.  */
  13. class Direction
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=true)
  23.      */
  24.     private $uuid;
  25.     /**
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      */
  28.     private $token;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      */
  32.     private $slug;
  33.     /**
  34.      * @ORM\Column(type="boolean", nullable=true)
  35.      */
  36.     private $statut false;
  37.     /**
  38.      * @ORM\Column(type="datetime_immutable", nullable=true)
  39.      */
  40.     private $createdAt;
  41.     /**
  42.      * @ORM\Column(type="datetime", nullable=true)
  43.      */
  44.     private $updatedAt;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=true)
  47.      */
  48.     private $nom;
  49.     /**
  50.      * @ORM\OneToMany(targetEntity=Cv::class, mappedBy="direction")
  51.      */
  52.     private $cvs;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity=Droit::class, mappedBy="direction")
  55.      */
  56.     private $droits;
  57.     /**
  58.      * @ORM\OneToMany(targetEntity=Post::class, mappedBy="direction")
  59.      */
  60.     private $posts;
  61.     /**
  62.      * @ORM\OneToMany(targetEntity=Agora::class, mappedBy="direction")
  63.      */
  64.     private $agoras;
  65.     /**
  66.      * @ORM\OneToMany(targetEntity=Referent::class, mappedBy="direction")
  67.      */
  68.     private $referents;
  69.     public function __construct()
  70.     {
  71.         $this->uuid Uuid::v4();
  72.         $this->cvs = new ArrayCollection();
  73.         $this->droits = new ArrayCollection();
  74.         $this->posts = new ArrayCollection();
  75.         $this->agoras = new ArrayCollection();
  76.         $this->referents = new ArrayCollection();
  77.     }
  78.     public function getId(): ?int
  79.     {
  80.         return $this->id;
  81.     }
  82.     public function getUuid(): ?string
  83.     {
  84.         return $this->uuid;
  85.     }
  86.     public function setUuid(?string $uuid): self
  87.     {
  88.         $this->uuid $uuid;
  89.         return $this;
  90.     }
  91.     public function getToken(): ?string
  92.     {
  93.         return $this->token;
  94.     }
  95.     public function setToken(?string $token): self
  96.     {
  97.         $this->token $token;
  98.         return $this;
  99.     }
  100.     public function getSlug(): ?string
  101.     {
  102.         return $this->slug;
  103.     }
  104.     public function setSlug(?string $slug): self
  105.     {
  106.         $this->slug $slug;
  107.         return $this;
  108.     }
  109.     public function isStatut(): ?bool
  110.     {
  111.         return $this->statut;
  112.     }
  113.     public function setStatut(?bool $statut): self
  114.     {
  115.         $this->statut $statut;
  116.         return $this;
  117.     }
  118.     public function getCreatedAt(): ?\DateTimeImmutable
  119.     {
  120.         return $this->createdAt;
  121.     }
  122.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  123.     {
  124.         $this->createdAt $createdAt;
  125.         return $this;
  126.     }
  127.     public function getUpdatedAt(): ?\DateTimeInterface
  128.     {
  129.         return $this->updatedAt;
  130.     }
  131.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  132.     {
  133.         $this->updatedAt $updatedAt;
  134.         return $this;
  135.     }
  136.     public function getNom(): ?string
  137.     {
  138.         return $this->nom;
  139.     }
  140.     public function setNom(?string $nom): self
  141.     {
  142.         $this->nom $nom;
  143.         return $this;
  144.     }
  145.     /**
  146.      * @return Collection<int, Cv>
  147.      */
  148.     public function getCvs(): Collection
  149.     {
  150.         return $this->cvs;
  151.     }
  152.     public function addCv(Cv $cv): self
  153.     {
  154.         if (!$this->cvs->contains($cv)) {
  155.             $this->cvs[] = $cv;
  156.             $cv->setDirection($this);
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeCv(Cv $cv): self
  161.     {
  162.         if ($this->cvs->removeElement($cv)) {
  163.             // set the owning side to null (unless already changed)
  164.             if ($cv->getDirection() === $this) {
  165.                 $cv->setDirection(null);
  166.             }
  167.         }
  168.         return $this;
  169.     }
  170.     /**
  171.      * @return Collection<int, Droit>
  172.      */
  173.     public function getDroits(): Collection
  174.     {
  175.         return $this->droits;
  176.     }
  177.     public function addDroit(Droit $droit): self
  178.     {
  179.         if (!$this->droits->contains($droit)) {
  180.             $this->droits[] = $droit;
  181.             $droit->setDirection($this);
  182.         }
  183.         return $this;
  184.     }
  185.     public function removeDroit(Droit $droit): self
  186.     {
  187.         if ($this->droits->removeElement($droit)) {
  188.             // set the owning side to null (unless already changed)
  189.             if ($droit->getDirection() === $this) {
  190.                 $droit->setDirection(null);
  191.             }
  192.         }
  193.         return $this;
  194.     }
  195.     /**
  196.      * @return Collection<int, Post>
  197.      */
  198.     public function getPosts(): Collection
  199.     {
  200.         return $this->posts;
  201.     }
  202.     public function addPost(Post $post): self
  203.     {
  204.         if (!$this->posts->contains($post)) {
  205.             $this->posts[] = $post;
  206.             $post->setDirection($this);
  207.         }
  208.         return $this;
  209.     }
  210.     public function removePost(Post $post): self
  211.     {
  212.         if ($this->posts->removeElement($post)) {
  213.             // set the owning side to null (unless already changed)
  214.             if ($post->getDirection() === $this) {
  215.                 $post->setDirection(null);
  216.             }
  217.         }
  218.         return $this;
  219.     }
  220.     /**
  221.      * @return Collection<int, Agora>
  222.      */
  223.     public function getAgoras(): Collection
  224.     {
  225.         return $this->agoras;
  226.     }
  227.     public function addAgora(Agora $agora): self
  228.     {
  229.         if (!$this->agoras->contains($agora)) {
  230.             $this->agoras[] = $agora;
  231.             $agora->setDirection($this);
  232.         }
  233.         return $this;
  234.     }
  235.     public function removeAgora(Agora $agora): self
  236.     {
  237.         if ($this->agoras->removeElement($agora)) {
  238.             // set the owning side to null (unless already changed)
  239.             if ($agora->getDirection() === $this) {
  240.                 $agora->setDirection(null);
  241.             }
  242.         }
  243.         return $this;
  244.     }
  245.     /**
  246.      * @return Collection<int, Referent>
  247.      */
  248.     public function getReferents(): Collection
  249.     {
  250.         return $this->referents;
  251.     }
  252.     public function addReferent(Referent $referent): self
  253.     {
  254.         if (!$this->referents->contains($referent)) {
  255.             $this->referents[] = $referent;
  256.             $referent->setDirection($this);
  257.         }
  258.         return $this;
  259.     }
  260.     public function removeReferent(Referent $referent): self
  261.     {
  262.         if ($this->referents->removeElement($referent)) {
  263.             // set the owning side to null (unless already changed)
  264.             if ($referent->getDirection() === $this) {
  265.                 $referent->setDirection(null);
  266.             }
  267.         }
  268.         return $this;
  269.     }
  270. }