<?phpnamespace App\Entity;use App\Entity\User;use App\Entity\Chantier;use Doctrine\ORM\Mapping as ORM;use App\Entity\Traits\EntityTrait;use App\Repository\CommentRepository;/** * @ORM\Entity(repositoryClass=CommentRepository::class) */class Comment{ use EntityTrait { EntityTrait::__construct as private __entityConstruct; } /** * @ORM\Column(type="text") */ private $content; /** * @ORM\Column(type="text",nullable=true) */ private $type; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="comments") * @ORM\JoinColumn(nullable=false) */ private $user; /** * @ORM\ManyToOne(targetEntity=Chantier::class, inversedBy="comments") * @ORM\JoinColumn(nullable=false) */ private $chantier; public function __toString() { return $this->getUser()->getFullName(); } public function getId(): ?int { return $this->id; } public function getContent(): ?string { return $this->content; } public function setContent(string $content): self { $this->content = $content; return $this; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { if ($type != 'null') { $this->type = $type; } else{ $this->type = NULL; } return $this; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getChantier(): ?Chantier { return $this->chantier; } public function setChantier(?Chantier $chantier): self { $this->chantier = $chantier; return $this; }}