<?phpnamespace App\Entity;use App\Repository\ForumReponseRepository;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Doctrine\Common\Collections\Collection;use Doctrine\Common\Collections\ArrayCollection;#[ORM\Entity(repositoryClass: ForumReponseRepository::class)]class ForumReponse{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\ManyToOne(targetEntity: User::class)] private $user; #[ORM\Column(type: Types::TEXT)] private ?string $reponse = null; #[ORM\Column(type: Types::DATE_MUTABLE)] private ?\DateTimeInterface $date = null; #[ORM\Column(type: 'boolean')] private $etat = false; #[ORM\ManyToOne(inversedBy: 'reponse')] private ?Sujetforum $sujetforum = null; #[ORM\ManyToOne(inversedBy: 'children')] private ?ForumReponse $parent; #[ORM\OneToMany(mappedBy: 'parent', targetEntity: ForumReponse::class, cascade: ['persist', 'remove'])] private Collection $children; public function __construct() { $this->children = new ArrayCollection(); } /** * @return Collection<int, ForumReponse> */ public function getChildren(): Collection { return $this->children; } public function addChildren(ForumReponse $children): self { if (!$this->children->contains($children)) { $this->children->add($children); $children->setParent($this); } return $this; } public function removeChildren(ForumReponse $children): self { if ($this->children->removeElement($children)) { // set the owning side to null (unless already changed) if ($children->getSujetforum() === $this) { $children->setSujetforum(null); } } return $this; } 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 getReponse(): ?string { return $this->reponse; } public function setReponse(string $reponse): self { $this->reponse = $reponse; return $this; } public function getDate(): ?\DateTimeInterface { return $this->date; } public function setDate(?\DateTimeInterface $date): ?self { $this->date = $date; return $this; } public function isEtat(): ?bool { return $this->etat; } public function setEtat(bool $etat): self { $this->etat = $etat; return $this; } public function getSujetforum(): ?Sujetforum { return $this->sujetforum; } public function setSujetforum(?Sujetforum $sujetforum): self { $this->sujetforum = $sujetforum; return $this; } public function getParent(): ?ForumReponse { return $this->parent; } public function setParent(?ForumReponse $parent): self { $this->parent = $parent; return $this; } public function addChild(ForumReponse $child): self { if (!$this->children->contains($child)) { $this->children->add($child); $child->setParent($this); } return $this; } public function removeChild(ForumReponse $child): self { if ($this->children->removeElement($child)) { // set the owning side to null (unless already changed) if ($child->getParent() === $this) { $child->setParent(null); } } return $this; } public function __toString() { return "Autres Commentaire"; }}