src/Entity/Commentaires.php line 18
<?phpnamespace App\Entity;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use App\Repository\CommentairesRepository;use Doctrine\Common\Collections\Collection;use Doctrine\Common\Collections\ArrayCollection;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;#[ORM\Entity(repositoryClass: CommentairesRepository::class)]#[UniqueEntity(fields: ['user', 'projet'],message: 'Tu a déjà commenté ce projet.',)]class Commentaires{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(type: Types::TEXT)]private ?string $text = null;#[ORM\ManyToOne(inversedBy: 'commentaires')]private ?User $user = null;#[ORM\ManyToOne(inversedBy: 'commentaires')]private ?UserProjets $projet = null;#[ORM\OneToMany(mappedBy: 'commentaire', targetEntity: Notes::class, cascade: ['persist', 'remove'])]private Collection $notes;#[ORM\Column]private ?\DateTimeImmutable $createdAt = null;public function __construct(){$this->notes = new ArrayCollection();$this->createdAt = new \DateTimeImmutable();}public function getId(): ?int{return $this->id;}public function getText(): ?string{return $this->text;}public function setText(string $text): self{$this->text = $text;return $this;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): self{$this->user = $user;return $this;}public function getProjet(): ?UserProjets{return $this->projet;}public function setProjet(?UserProjets $projet): self{$this->projet = $projet;return $this;}/*** @return Collection<int, Notes>*/public function getNotes(): Collection{return $this->notes;}public function addNote(Notes $note): self{if (!$this->notes->contains($note)) {$this->notes->add($note);$note->setCommentaire($this);}return $this;}public function removeNote(Notes $note): self{if ($this->notes->removeElement($note)) {// set the owning side to null (unless already changed)if ($note->getCommentaire() === $this) {$note->setCommentaire(null);}}return $this;}public function getCreatedAt(): ?\DateTimeImmutable{return $this->createdAt;}public function setCreatedAt(\DateTimeImmutable $createdAt): self{$this->createdAt = $createdAt;return $this;}}