<?phpnamespace App\Entity;use App\Repository\CommentRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=CommentRepository::class) */class Comment{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="text", nullable=true) */ private $description; /** * @ORM\ManyToOne(targetEntity=Document::class, inversedBy="comments") */ private $document; /** * @ORM\ManyToOne(targetEntity=Comment::class, inversedBy="comments") */ private $childComment; /** * @ORM\OneToMany(targetEntity=Comment::class, mappedBy="childComment") */ private $comments; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="comments") */ private $user; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="notes") */ private $client; /** * @ORM\ManyToOne(targetEntity=Document::class, inversedBy="documentComments") */ private $documentComment; /** * @ORM\Column(type="datetime") */ private $createAt; /** * @ORM\ManyToOne(targetEntity=Produit::class, inversedBy="comments") */ private $produit; public function __construct() { $this->comments = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } public function getDocument(): ?Document { return $this->document; } public function setDocument(?Document $document): self { $this->document = $document; return $this; } public function getChildComment(): ?self { return $this->childComment; } public function setChildComment(?self $childComment): self { $this->childComment = $childComment; return $this; } /** * @return Collection|self[] */ public function getComments(): Collection { return $this->comments; } public function addComment(self $comment): self { if( !$this->comments->contains($comment)) { $this->comments[] = $comment; $comment->setChildComment($this); } return $this; } public function removeComment(self $comment): self { if( $this->comments->removeElement($comment)) { // set the owning side to null (unless already changed) if( $comment->getChildComment() === $this) { $comment->setChildComment(null); } } return $this; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getDocumentComment(): ?Document { return $this->documentComment; } public function setDocumentComment(?Document $documentComment): self { $this->documentComment = $documentComment; return $this; } public function getClient(): ?User { return $this->client; } public function setClient(?User $client): self { $this->client = $client; return $this; } public function getCreateAt(): ?\DateTimeInterface { return $this->createAt; } public function setCreateAt(\DateTimeInterface $createAt): self { $this->createAt = $createAt; return $this; } public function getProduit(): ?Produit { return $this->produit; } public function setProduit(?Produit $produit): self { $this->produit = $produit; return $this; }}