<?phpnamespace App\Entity;use App\Repository\SujetforumRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: SujetforumRepository::class)]class Sujetforum{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $sujet = null; #[ORM\Column(type: Types::TEXT, length:10000)] private ?string $description = null; #[ORM\Column(type: 'boolean')] private $isPublic = false; #[ORM\ManyToOne()] private ?User $user = null; #[ORM\Column(type: 'date',nullable:true)] private $date = null; #[ORM\Column(type: 'date',nullable:true)] private $date_public = null; #[ORM\OneToMany(mappedBy: 'sujetforum', targetEntity: ForumReponse::class, cascade: ['remove'])] private Collection $reponse; public function __construct() { $this->reponse = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): ?self { $this->user = $user; return $this; } public function getSujet(): ?string { return $this->sujet; } public function setSujet(string $sujet): self { $this->sujet = $sujet; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(string $description): self { $this->description = $description; return $this; } public function isIsPublic(): ?bool { return $this->isPublic; } public function setIsPublic(bool $isPublic): self { $this->isPublic = $isPublic; return $this; } /** * @return Collection<int, ForumReponse> */ public function getReponse(): Collection { return $this->reponse; } public function addReponse(ForumReponse $reponse): self { if (!$this->reponse->contains($reponse)) { $this->reponse->add($reponse); $reponse->setSujetforum($this); } return $this; } public function removeReponse(ForumReponse $reponse): self { if ($this->reponse->removeElement($reponse)) { // set the owning side to null (unless already changed) if ($reponse->getSujetforum() === $this) { $reponse->setSujetforum(null); } } return $this; } public function __toString() { return $this->sujet; } public function getDate(): ?\DateTimeInterface { return $this->date; } public function setDate(\DateTimeInterface $date): self { $this->date = $date; return $this; } /** * @return null */ public function getDatePublic() { return $this->date_public; } /** * @param null $date_public */ public function setDatePublic($date_public): void { $this->date_public = $date_public; } }