src/Entity/Grade.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\GradeRepository;
  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=GradeRepository::class)
  11.  * @UniqueEntity(fields={"nom"}, message="Ce grade existe déjà")
  12.  */
  13. class Grade
  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="grade")
  51.      */
  52.     private $cvs;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity=Droit::class, mappedBy="grade")
  55.      */
  56.     private $droits;
  57.     /**
  58.      * @ORM\OneToMany(targetEntity=Post::class, mappedBy="grade")
  59.      */
  60.     private $posts;
  61.     /**
  62.      * @ORM\OneToMany(targetEntity=Agora::class, mappedBy="grade")
  63.      */
  64.     private $agoras;
  65.     public function __construct()
  66.     {
  67.         $this->uuid Uuid::v4();
  68.         $this->cvs = new ArrayCollection();
  69.         $this->droits = new ArrayCollection();
  70.         $this->posts = new ArrayCollection();
  71.         $this->agoras = new ArrayCollection();
  72.     }
  73.     public function getId(): ?int
  74.     {
  75.         return $this->id;
  76.     }
  77.     public function getUuid(): ?string
  78.     {
  79.         return $this->uuid;
  80.     }
  81.     public function setUuid(?string $uuid): self
  82.     {
  83.         $this->uuid $uuid;
  84.         return $this;
  85.     }
  86.     public function getToken(): ?string
  87.     {
  88.         return $this->token;
  89.     }
  90.     public function setToken(?string $token): self
  91.     {
  92.         $this->token $token;
  93.         return $this;
  94.     }
  95.     public function getSlug(): ?string
  96.     {
  97.         return $this->slug;
  98.     }
  99.     public function setSlug(?string $slug): self
  100.     {
  101.         $this->slug $slug;
  102.         return $this;
  103.     }
  104.     public function isStatut(): ?bool
  105.     {
  106.         return $this->statut;
  107.     }
  108.     public function setStatut(?bool $statut): self
  109.     {
  110.         $this->statut $statut;
  111.         return $this;
  112.     }
  113.     public function getCreatedAt(): ?\DateTimeImmutable
  114.     {
  115.         return $this->createdAt;
  116.     }
  117.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  118.     {
  119.         $this->createdAt $createdAt;
  120.         return $this;
  121.     }
  122.     public function getUpdatedAt(): ?\DateTimeInterface
  123.     {
  124.         return $this->updatedAt;
  125.     }
  126.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  127.     {
  128.         $this->updatedAt $updatedAt;
  129.         return $this;
  130.     }
  131.     public function getNom(): ?string
  132.     {
  133.         return $this->nom;
  134.     }
  135.     public function setNom(?string $nom): self
  136.     {
  137.         $this->nom $nom;
  138.         return $this;
  139.     }
  140.     /**
  141.      * @return Collection<int, Cv>
  142.      */
  143.     public function getCvs(): Collection
  144.     {
  145.         return $this->cvs;
  146.     }
  147.     public function addCv(Cv $cv): self
  148.     {
  149.         if (!$this->cvs->contains($cv)) {
  150.             $this->cvs[] = $cv;
  151.             $cv->setGrade($this);
  152.         }
  153.         return $this;
  154.     }
  155.     public function removeCv(Cv $cv): self
  156.     {
  157.         if ($this->cvs->removeElement($cv)) {
  158.             // set the owning side to null (unless already changed)
  159.             if ($cv->getGrade() === $this) {
  160.                 $cv->setGrade(null);
  161.             }
  162.         }
  163.         return $this;
  164.     }
  165.     /**
  166.      * @return Collection<int, Droit>
  167.      */
  168.     public function getDroits(): Collection
  169.     {
  170.         return $this->droits;
  171.     }
  172.     public function addDroit(Droit $droit): self
  173.     {
  174.         if (!$this->droits->contains($droit)) {
  175.             $this->droits[] = $droit;
  176.             $droit->setGrade($this);
  177.         }
  178.         return $this;
  179.     }
  180.     public function removeDroit(Droit $droit): self
  181.     {
  182.         if ($this->droits->removeElement($droit)) {
  183.             // set the owning side to null (unless already changed)
  184.             if ($droit->getGrade() === $this) {
  185.                 $droit->setGrade(null);
  186.             }
  187.         }
  188.         return $this;
  189.     }
  190.     /**
  191.      * @return Collection<int, Post>
  192.      */
  193.     public function getPosts(): Collection
  194.     {
  195.         return $this->posts;
  196.     }
  197.     public function addPost(Post $post): self
  198.     {
  199.         if (!$this->posts->contains($post)) {
  200.             $this->posts[] = $post;
  201.             $post->setGrade($this);
  202.         }
  203.         return $this;
  204.     }
  205.     public function removePost(Post $post): self
  206.     {
  207.         if ($this->posts->removeElement($post)) {
  208.             // set the owning side to null (unless already changed)
  209.             if ($post->getGrade() === $this) {
  210.                 $post->setGrade(null);
  211.             }
  212.         }
  213.         return $this;
  214.     }
  215.     /**
  216.      * @return Collection<int, Agora>
  217.      */
  218.     public function getAgoras(): Collection
  219.     {
  220.         return $this->agoras;
  221.     }
  222.     public function addAgora(Agora $agora): self
  223.     {
  224.         if (!$this->agoras->contains($agora)) {
  225.             $this->agoras[] = $agora;
  226.             $agora->setGrade($this);
  227.         }
  228.         return $this;
  229.     }
  230.     public function removeAgora(Agora $agora): self
  231.     {
  232.         if ($this->agoras->removeElement($agora)) {
  233.             // set the owning side to null (unless already changed)
  234.             if ($agora->getGrade() === $this) {
  235.                 $agora->setGrade(null);
  236.             }
  237.         }
  238.         return $this;
  239.     }
  240. }