src/Entity/Lexique.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LexiqueRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity(repositoryClass=LexiqueRepository::class)
  10.  */
  11. class Lexique
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="boolean")
  21.      */
  22.     private bool $active false;
  23.     /**
  24.      * @Assert\NotBlank
  25.      * @ORM\Column(type="string", length=255)
  26.      */
  27.     private string $word;
  28.     /**
  29.      * @Assert\NotBlank
  30.      * @ORM\Column(type="text")
  31.      */
  32.     private string $definition;
  33.     /**
  34.      * @ORM\Column(type="datetime")
  35.      */
  36.     private ?\DateTime $createdAt;
  37.     /**
  38.      * @ORM\ManyToMany(targetEntity="App\Entity\News", mappedBy="listelexique")
  39.      */
  40.     private $mentionsNews;
  41.     /**
  42.      * @ORM\ManyToMany(targetEntity="App\Entity\Tuto", mappedBy="listelexique")
  43.      */
  44.     private $mentionsTutos;
  45.     /**
  46.      * @ORM\ManyToMany(targetEntity="App\Entity\Jurisprudence", mappedBy="listelexique")
  47.      */
  48.     private $mentionsJp;
  49.     public function __construct()
  50.     {
  51.         $this->createdAt = new \DateTime();
  52.         $this->mentionsNews = new ArrayCollection();
  53.         $this->mentionsTutos = new ArrayCollection();
  54.     }
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getWord(): ?string
  60.     {
  61.         return $this->word;
  62.     }
  63.     public function setWord(string $word): self
  64.     {
  65.         $this->word $word;
  66.         return $this;
  67.     }
  68.     public function getDefinition(): ?string
  69.     {
  70.         return $this->definition;
  71.     }
  72.     public function setDefinition(string $definition): self
  73.     {
  74.         $this->definition $definition;
  75.         return $this;
  76.     }
  77.     public function getCreatedAt(): ?\DateTimeInterface
  78.     {
  79.         return $this->createdAt;
  80.     }
  81.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  82.     {
  83.         $this->createdAt $createdAt;
  84.         return $this;
  85.     }
  86.     public function isActive(): bool
  87.     {
  88.         return $this->active;
  89.     }
  90.     public function setActive(bool $active): void
  91.     {
  92.         $this->active $active;
  93.     }
  94.     //MANY TO MANY NEWS -> LEXIQUE
  95.     public function getMentionsNews(): Collection
  96.     {
  97.         return $this->mentionsNews;
  98.     }
  99.     public function addMentionNews(News $news): self
  100.     {
  101.         if (!$this->mentionsNews->contains($news)) {
  102.             $this->mentionsNews[] = $news;
  103.             $news->addListelexique($this);
  104.         }
  105.         return $this;
  106.     }
  107.     public function removeMentionNews(News $news): self
  108.     {
  109.         if ($this->mentionsNews->removeElement($news)) {
  110.             $news->removeListelexique($this);
  111.         }
  112.         return $this;
  113.     }
  114.     //MANY TO MANY TUTOS -> LEXIQUE
  115.     public function getMentionsTutos(): Collection
  116.     {
  117.         return $this->mentionsTutos;
  118.     }
  119.     public function addMentionTuto(Tuto $tuto): self
  120.     {
  121.         if (!$this->mentionsTutos->contains($tuto)) {
  122.             $this->mentionsTutos[] = $tuto;
  123.             $tuto->addListelexique($this);
  124.         }
  125.         return $this;
  126.     }
  127.     public function removeMentionTuto(Tuto $tuto): self
  128.     {
  129.         if ($this->mentionsTutos->removeElement($tuto)) {
  130.             $tuto->removeListelexique($this);
  131.         }
  132.         return $this;
  133.     }
  134.     //MANY TO MANY JPs -> LEXIQUE
  135.     public function getMentionsJp(): Collection
  136.     {
  137.         return $this->mentionsJp;
  138.     }
  139.     public function addMentionJp(Jurisprudence $jurisprudence): self
  140.     {
  141.         if (!$this->mentionsJp->contains($jurisprudence)) {
  142.             $this->mentionsJp[] = $jurisprudence;
  143.             $jurisprudence->addListelexique($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removeMentionJp(Jurisprudence $jurisprudence): self
  148.     {
  149.         if ($this->mentionsJp->removeElement($jurisprudence)) {
  150.             $jurisprudence->removeListelexique($this);
  151.         }
  152.         return $this;
  153.     }
  154. }