src/Entity/Topic.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TopicRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassTopicRepository::class)]
  8. class Topic implements \Stringable
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private ?int $id null;
  14.     #[ORM\Column(type'string'length255nullabletrue)]
  15.     private ?string $kindnull;
  16.     #[ORM\Column(type'string'length255nullabletrue)]
  17.     private ?string $display_namenull;
  18.     #[ORM\ManyToMany(targetEntityPost::class, mappedBy'topics')]
  19.     private mixed $posts;
  20.     #[ORM\ManyToMany(targetEntityUser::class, mappedBy'thematiques')]
  21.     private mixed $users;
  22.     #[ORM\ManyToMany(targetEntityRssArticle::class, mappedBy'thematiques')]
  23.     private mixed $rssArticles;
  24.     #[ORM\ManyToMany(targetEntityRssEvent::class, mappedBy'thematiques')]
  25.     private mixed $rssEvents;
  26.     public function __construct()
  27.     {
  28.         $this->posts = new ArrayCollection();
  29.         $this->users = new ArrayCollection();
  30.         $this->rssArticles = new ArrayCollection();
  31.         $this->rssEvents = new ArrayCollection();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getKind(): ?string
  38.     {
  39.         return $this->kind;
  40.     }
  41.     public function setKind(?string $kind): self
  42.     {
  43.         $this->kind $kind;
  44.         return $this;
  45.     }
  46.     public function getDisplayName(): ?string
  47.     {
  48.         return $this->display_name;
  49.     }
  50.     public function setDisplayName(?string $display_name): self
  51.     {
  52.         $this->display_name $display_name;
  53.         return $this;
  54.     }
  55.     /**
  56.      * @return Collection|Post[]
  57.      */
  58.     public function getPosts(): Collection
  59.     {
  60.         return $this->posts;
  61.     }
  62.     public function addPost(Post $post): self
  63.     {
  64.         if (!$this->posts->contains($post)) {
  65.             $this->posts[] = $post;
  66.             $post->addTopic($this);
  67.         }
  68.         return $this;
  69.     }
  70.     public function removePost(Post $post): self
  71.     {
  72.         if ($this->posts->contains($post)) {
  73.             $this->posts->removeElement($post);
  74.             $post->removeTopic($this);
  75.         }
  76.         return $this;
  77.     }
  78.     public function __toString(): string
  79.     {
  80.         return (string) $this->display_name;
  81.     }
  82.     /**
  83.      * @return Collection|User[]
  84.      */
  85.     public function getUsers(): Collection
  86.     {
  87.         return $this->users;
  88.     }
  89.     public function addUser(User $user): self
  90.     {
  91.         if (!$this->users->contains($user)) {
  92.             $this->users[] = $user;
  93.             $user->addThematique($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeUser(User $user): self
  98.     {
  99.         if ($this->users->contains($user)) {
  100.             $this->users->removeElement($user);
  101.             $user->removeThematique($this);
  102.         }
  103.         return $this;
  104.     }
  105.     /**
  106.      * @return Collection|RssArticle[]
  107.      */
  108.     public function getRssArticles(): Collection
  109.     {
  110.         return $this->rssArticles;
  111.     }
  112.     public function addRssArticle(RssArticle $rssArticle): self
  113.     {
  114.         if (!$this->rssArticles->contains($rssArticle)) {
  115.             $this->rssArticles[] = $rssArticle;
  116.             $rssArticle->addThematique($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removeRssArticle(RssArticle $rssArticle): self
  121.     {
  122.         if ($this->rssArticles->contains($rssArticle)) {
  123.             $this->rssArticles->removeElement($rssArticle);
  124.             $rssArticle->removeThematique($this);
  125.         }
  126.         return $this;
  127.     }
  128.     /**
  129.      * @return Collection|RssEvent[]
  130.      */
  131.     public function getRssEvents(): Collection
  132.     {
  133.         return $this->rssEvents;
  134.     }
  135.     public function addRssEvent(RssEvent $rssEvent): self
  136.     {
  137.         if (!$this->rssEvents->contains($rssEvent)) {
  138.             $this->rssEvents[] = $rssEvent;
  139.             $rssEvent->addThematique($this);
  140.         }
  141.         return $this;
  142.     }
  143.     public function removeRssEvent(RssEvent $rssEvent): self
  144.     {
  145.         if ($this->rssEvents->contains($rssEvent)) {
  146.             $this->rssEvents->removeElement($rssEvent);
  147.             $rssEvent->removeThematique($this);
  148.         }
  149.         return $this;
  150.     }
  151. }