src/Entity/Forum.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ForumRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ForumRepository::class)
  9.  */
  10. class Forum
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255, nullable=true)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="text", nullable=true)
  24.      */
  25.     private $description;
  26.     /**
  27.      * @ORM\Column(type="integer", nullable=true)
  28.      */
  29.     private $ordre;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=ForumCategorie::class, mappedBy="forum")
  32.      */
  33.     private $category;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=ForumPost::class, mappedBy="forum")
  36.      */
  37.     private $post;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=ForumTopic::class, mappedBy="forum")
  40.      */
  41.     private $topic;
  42.     /**
  43.      * @ORM\Column(type="boolean", nullable=true)
  44.      */
  45.     private $isActive;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity=Notification::class, mappedBy="forum")
  48.      */
  49.     private $notifications;
  50.     private $nbTopic;
  51.     private $nbPost;
  52.     private $lastPostForum;
  53.     private $nbNotifForum;
  54.     public function __construct()
  55.     {
  56.         $this->category = new ArrayCollection();
  57.         $this->post = new ArrayCollection();
  58.         $this->topic = new ArrayCollection();
  59.         $this->nbTopic 0;
  60.         $this->nbPost 0;
  61.         $this->nbNotifForum 0;
  62.         $this->notifications = new ArrayCollection();
  63.     }
  64.     public function getId(): ?int
  65.     {
  66.         return $this->id;
  67.     }
  68.     public function getName(): ?string
  69.     {
  70.         return $this->name;
  71.     }
  72.     public function setName(?string $name): self
  73.     {
  74.         $this->name $name;
  75.         return $this;
  76.     }
  77.     public function getDescription(): ?string
  78.     {
  79.         return $this->description;
  80.     }
  81.     public function setDescription(?string $description): self
  82.     {
  83.         $this->description $description;
  84.         return $this;
  85.     }
  86.     public function getOrdre(): ?int
  87.     {
  88.         return $this->ordre;
  89.     }
  90.     public function setOrdre(?int $ordre): self
  91.     {
  92.         $this->ordre $ordre;
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return Collection<int, ForumCategorie>
  97.      */
  98.     public function getCategory(): Collection
  99.     {
  100.         return $this->category;
  101.     }
  102.     public function addCategory(ForumCategorie $category): self
  103.     {
  104.         if (!$this->category->contains($category)) {
  105.             $this->category[] = $category;
  106.             $category->setForum($this);
  107.         }
  108.         return $this;
  109.     }
  110.     public function removeCategory(ForumCategorie $category): self
  111.     {
  112.         if ($this->category->removeElement($category)) {
  113.             // set the owning side to null (unless already changed)
  114.             if ($category->getForum() === $this) {
  115.                 $category->setForum(null);
  116.             }
  117.         }
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection<int, ForumPost>
  122.      */
  123.     public function getPost(): Collection
  124.     {
  125.         return $this->post;
  126.     }
  127.     public function addPost(ForumPost $post): self
  128.     {
  129.         if (!$this->post->contains($post)) {
  130.             $this->post[] = $post;
  131.             $post->setForum($this);
  132.         }
  133.         return $this;
  134.     }
  135.     public function removePost(ForumPost $post): self
  136.     {
  137.         if ($this->post->removeElement($post)) {
  138.             // set the owning side to null (unless already changed)
  139.             if ($post->getForum() === $this) {
  140.                 $post->setForum(null);
  141.             }
  142.         }
  143.         return $this;
  144.     }
  145.     /**
  146.      * @return Collection<int, ForumTopic>
  147.      */
  148.     public function getTopic(): Collection
  149.     {
  150.         return $this->topic;
  151.     }
  152.     public function addTopic(ForumTopic $topic): self
  153.     {
  154.         if (!$this->topic->contains($topic)) {
  155.             $this->topic[] = $topic;
  156.             $topic->setForum($this);
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeTopic(ForumTopic $topic): self
  161.     {
  162.         if ($this->topic->removeElement($topic)) {
  163.             // set the owning side to null (unless already changed)
  164.             if ($topic->getForum() === $this) {
  165.                 $topic->setForum(null);
  166.             }
  167.         }
  168.         return $this;
  169.     }
  170.     /**
  171.      * Get the value of nbTopic
  172.      */ 
  173.     public function getNbTopic()
  174.     {
  175.         return $this->nbTopic;
  176.     }
  177.     /**
  178.      * Set the value of nbTopic
  179.      *
  180.      * @return  self
  181.      */ 
  182.     public function setNbTopic($nbTopic)
  183.     {
  184.         $this->nbTopic $nbTopic;
  185.         return $this;
  186.     }
  187.     /**
  188.      * Get the value of nbPost
  189.      */ 
  190.     public function getNbPost()
  191.     {
  192.         return $this->nbPost;
  193.     }
  194.     /**
  195.      * Set the value of nbPost
  196.      *
  197.      * @return  self
  198.      */ 
  199.     public function setNbPost($nbPost)
  200.     {
  201.         $this->nbPost $nbPost;
  202.         return $this;
  203.     }
  204.     /**
  205.      * Get the value of lastPostForum
  206.      */ 
  207.     public function getLastPostForum()
  208.     {
  209.         return $this->lastPostForum;
  210.     }
  211.     /**
  212.      * Set the value of lastPostForum
  213.      *
  214.      * @return  self
  215.      */ 
  216.     public function setLastPostForum($lastPostForum)
  217.     {
  218.         $this->lastPostForum $lastPostForum;
  219.         return $this;
  220.     }
  221.     public function getIsActive(): ?bool
  222.     {
  223.         return $this->isActive;
  224.     }
  225.     public function setIsActive(?bool $isActive): self
  226.     {
  227.         $this->isActive $isActive;
  228.         return $this;
  229.     }
  230.     /**
  231.      * @return Collection<int, Notification>
  232.      */
  233.     public function getNotifications(): Collection
  234.     {
  235.         return $this->notifications;
  236.     }
  237.     public function addNotification(Notification $notification): self
  238.     {
  239.         if (!$this->notifications->contains($notification)) {
  240.             $this->notifications[] = $notification;
  241.             $notification->setForum($this);
  242.         }
  243.         return $this;
  244.     }
  245.     public function removeNotification(Notification $notification): self
  246.     {
  247.         if ($this->notifications->removeElement($notification)) {
  248.             // set the owning side to null (unless already changed)
  249.             if ($notification->getForum() === $this) {
  250.                 $notification->setForum(null);
  251.             }
  252.         }
  253.         return $this;
  254.     }
  255.     /**
  256.      * Get the value of nbNotifForum
  257.      */ 
  258.     public function getNbNotifForum()
  259.     {
  260.         return $this->nbNotifForum;
  261.     }
  262.     /**
  263.      * Set the value of nbNotifForum
  264.      *
  265.      * @return  self
  266.      */ 
  267.     public function setNbNotifForum($nbNotifForum)
  268.     {
  269.         $this->nbNotifForum $nbNotifForum;
  270.         return $this;
  271.     }
  272. }