<?phpnamespace App\Entity;use App\Repository\CommentEquipementProjetRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=CommentEquipementProjetRepository::class) */class CommentEquipementProjet{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="text") */ private $comment; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=User::class) */ private $user; /** * @ORM\ManyToOne(targetEntity=Project::class, inversedBy="commentEquipementProjets") */ private $projet; /** * @ORM\ManyToOne(targetEntity=CommentEquipementProjet::class, inversedBy="replies") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", nullable=true, onDelete="CASCADE") */ private $parent; /** * @ORM\OneToMany( * targetEntity=CommentEquipementProjet::class, * mappedBy="parent", * cascade={"persist", "remove"} ) * @ORM\OrderBy({"createdAt" = "ASC"}) */ private $replies; public function __construct() { $this->createdAt = new \DateTime(); $this->replies = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getComment(): ?string { return $this->comment; } public function setComment(string $comment): self { $this->comment = $comment; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } /** * @return mixed */ public function getProjet() { return $this->projet; } /** * @param mixed $projet */ public function setProjet($projet): void { $this->projet = $projet; } public function getParent(): ?self { return $this->parent; } public function setParent(?self $parent): self { $this->parent = $parent; return $this; } public function getReplies() { return $this->replies; } public function addReply(self $reply): self { if (!$this->replies->contains($reply)) { $this->replies[] = $reply; $reply->setParent($this); } return $this; } public function removeReply(self $reply): self { if ($this->replies->removeElement($reply)) { if ($reply->getParent() === $this) { $reply->setParent(null); } } return $this; }}