src/Entity/Lexique.php line 14

  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. #[ORM\Entity(repositoryClassLexiqueRepository::class)]
  9. class Lexique
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\Column(type'boolean')]
  16.     private bool $active false;
  17.     #[Assert\NotBlank]
  18.     #[ORM\Column(type'string'length255)]
  19.     private string $word;
  20.     #[Assert\NotBlank]
  21.     #[ORM\Column(type'text')]
  22.     private string $definition;
  23.     #[ORM\Column(type'datetime')]
  24.     private ?\DateTime $createdAt;
  25.     #[ORM\ManyToMany(targetEntity\App\Entity\News::class, mappedBy'listelexique')]
  26.     private $mentionsNews;
  27.     #[ORM\ManyToMany(targetEntity\App\Entity\Tuto::class, mappedBy'listelexique')]
  28.     private $mentionsTutos;
  29.     #[ORM\ManyToMany(targetEntity\App\Entity\Jurisprudence::class, mappedBy'listelexique')]
  30.     private $mentionsJp;
  31.     public function __construct()
  32.     {
  33.         $this->createdAt = new \DateTime();
  34.         $this->mentionsNews = new ArrayCollection();
  35.         $this->mentionsTutos = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getWord(): ?string
  42.     {
  43.         return $this->word;
  44.     }
  45.     public function setWord(string $word): self
  46.     {
  47.         $this->word $word;
  48.         return $this;
  49.     }
  50.     public function getDefinition(): ?string
  51.     {
  52.         return $this->definition;
  53.     }
  54.     public function setDefinition(string $definition): self
  55.     {
  56.         $this->definition $definition;
  57.         return $this;
  58.     }
  59.     public function getCreatedAt(): ?\DateTimeInterface
  60.     {
  61.         return $this->createdAt;
  62.     }
  63.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  64.     {
  65.         $this->createdAt $createdAt;
  66.         return $this;
  67.     }
  68.     public function isActive(): bool
  69.     {
  70.         return $this->active;
  71.     }
  72.     public function setActive(bool $active): void
  73.     {
  74.         $this->active $active;
  75.     }
  76.     //MANY TO MANY NEWS -> LEXIQUE
  77.     public function getMentionsNews(): Collection
  78.     {
  79.         return $this->mentionsNews;
  80.     }
  81.     public function addMentionNews(News $news): self
  82.     {
  83.         if (!$this->mentionsNews->contains($news)) {
  84.             $this->mentionsNews[] = $news;
  85.             $news->addListelexique($this);
  86.         }
  87.         return $this;
  88.     }
  89.     public function removeMentionNews(News $news): self
  90.     {
  91.         if ($this->mentionsNews->removeElement($news)) {
  92.             $news->removeListelexique($this);
  93.         }
  94.         return $this;
  95.     }
  96.     //MANY TO MANY TUTOS -> LEXIQUE
  97.     public function getMentionsTutos(): Collection
  98.     {
  99.         return $this->mentionsTutos;
  100.     }
  101.     public function addMentionTuto(Tuto $tuto): self
  102.     {
  103.         if (!$this->mentionsTutos->contains($tuto)) {
  104.             $this->mentionsTutos[] = $tuto;
  105.             $tuto->addListelexique($this);
  106.         }
  107.         return $this;
  108.     }
  109.     public function removeMentionTuto(Tuto $tuto): self
  110.     {
  111.         if ($this->mentionsTutos->removeElement($tuto)) {
  112.             $tuto->removeListelexique($this);
  113.         }
  114.         return $this;
  115.     }
  116.     //MANY TO MANY JPs -> LEXIQUE
  117.     public function getMentionsJp(): Collection
  118.     {
  119.         return $this->mentionsJp;
  120.     }
  121.     public function addMentionJp(Jurisprudence $jurisprudence): self
  122.     {
  123.         if (!$this->mentionsJp->contains($jurisprudence)) {
  124.             $this->mentionsJp[] = $jurisprudence;
  125.             $jurisprudence->addListelexique($this);
  126.         }
  127.         return $this;
  128.     }
  129.     public function removeMentionJp(Jurisprudence $jurisprudence): self
  130.     {
  131.         if ($this->mentionsJp->removeElement($jurisprudence)) {
  132.             $jurisprudence->removeListelexique($this);
  133.         }
  134.         return $this;
  135.     }
  136. }