<?php
namespace App\Entity;
use App\Repository\ForumRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ForumRepository::class)
*/
class Forum
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $ordre;
/**
* @ORM\OneToMany(targetEntity=ForumCategorie::class, mappedBy="forum")
*/
private $category;
/**
* @ORM\OneToMany(targetEntity=ForumPost::class, mappedBy="forum")
*/
private $post;
/**
* @ORM\OneToMany(targetEntity=ForumTopic::class, mappedBy="forum")
*/
private $topic;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isActive;
/**
* @ORM\OneToMany(targetEntity=Notification::class, mappedBy="forum")
*/
private $notifications;
private $nbTopic;
private $nbPost;
private $lastPostForum;
private $nbNotifForum;
public function __construct()
{
$this->category = new ArrayCollection();
$this->post = new ArrayCollection();
$this->topic = new ArrayCollection();
$this->nbTopic = 0;
$this->nbPost = 0;
$this->nbNotifForum = 0;
$this->notifications = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getOrdre(): ?int
{
return $this->ordre;
}
public function setOrdre(?int $ordre): self
{
$this->ordre = $ordre;
return $this;
}
/**
* @return Collection<int, ForumCategorie>
*/
public function getCategory(): Collection
{
return $this->category;
}
public function addCategory(ForumCategorie $category): self
{
if (!$this->category->contains($category)) {
$this->category[] = $category;
$category->setForum($this);
}
return $this;
}
public function removeCategory(ForumCategorie $category): self
{
if ($this->category->removeElement($category)) {
// set the owning side to null (unless already changed)
if ($category->getForum() === $this) {
$category->setForum(null);
}
}
return $this;
}
/**
* @return Collection<int, ForumPost>
*/
public function getPost(): Collection
{
return $this->post;
}
public function addPost(ForumPost $post): self
{
if (!$this->post->contains($post)) {
$this->post[] = $post;
$post->setForum($this);
}
return $this;
}
public function removePost(ForumPost $post): self
{
if ($this->post->removeElement($post)) {
// set the owning side to null (unless already changed)
if ($post->getForum() === $this) {
$post->setForum(null);
}
}
return $this;
}
/**
* @return Collection<int, ForumTopic>
*/
public function getTopic(): Collection
{
return $this->topic;
}
public function addTopic(ForumTopic $topic): self
{
if (!$this->topic->contains($topic)) {
$this->topic[] = $topic;
$topic->setForum($this);
}
return $this;
}
public function removeTopic(ForumTopic $topic): self
{
if ($this->topic->removeElement($topic)) {
// set the owning side to null (unless already changed)
if ($topic->getForum() === $this) {
$topic->setForum(null);
}
}
return $this;
}
/**
* Get the value of nbTopic
*/
public function getNbTopic()
{
return $this->nbTopic;
}
/**
* Set the value of nbTopic
*
* @return self
*/
public function setNbTopic($nbTopic)
{
$this->nbTopic = $nbTopic;
return $this;
}
/**
* Get the value of nbPost
*/
public function getNbPost()
{
return $this->nbPost;
}
/**
* Set the value of nbPost
*
* @return self
*/
public function setNbPost($nbPost)
{
$this->nbPost = $nbPost;
return $this;
}
/**
* Get the value of lastPostForum
*/
public function getLastPostForum()
{
return $this->lastPostForum;
}
/**
* Set the value of lastPostForum
*
* @return self
*/
public function setLastPostForum($lastPostForum)
{
$this->lastPostForum = $lastPostForum;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(?bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
/**
* @return Collection<int, Notification>
*/
public function getNotifications(): Collection
{
return $this->notifications;
}
public function addNotification(Notification $notification): self
{
if (!$this->notifications->contains($notification)) {
$this->notifications[] = $notification;
$notification->setForum($this);
}
return $this;
}
public function removeNotification(Notification $notification): self
{
if ($this->notifications->removeElement($notification)) {
// set the owning side to null (unless already changed)
if ($notification->getForum() === $this) {
$notification->setForum(null);
}
}
return $this;
}
/**
* Get the value of nbNotifForum
*/
public function getNbNotifForum()
{
return $this->nbNotifForum;
}
/**
* Set the value of nbNotifForum
*
* @return self
*/
public function setNbNotifForum($nbNotifForum)
{
$this->nbNotifForum = $nbNotifForum;
return $this;
}
}