<?phpnamespace App\Entity;use App\Repository\CommentRepository;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;/** * @ORM\Entity(repositoryClass=CommentRepository::class) */class Comment{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="comments") * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ private $user; /** * @ORM\ManyToOne(targetEntity=Photo::class, inversedBy="comments") * @ORM\JoinColumn(onDelete="CASCADE") */ private $photo; /** * @ORM\ManyToOne(targetEntity=Influencer::class, inversedBy="comments") * @ORM\JoinColumn(onDelete="CASCADE") */ private $influencer; /** * @ORM\Column(type="text") * @Assert\NotBlank() * @Assert\Length( * min = 3, * max = 500, * minMessage = "Comment must be at least {{ limit }} characters long", * maxMessage = "Comment cannot be longer than {{ limit }} characters" * ) * @Assert\Regex( * pattern = "#^((?!https).)*#" * ) */ private $comment; /** * @ORM\Column(type="datetime_immutable") */ private $created_at; /** * @ORM\Column(type="datetime") */ private $updated_at; /** * @ORM\ManyToOne(targetEntity=Video::class, inversedBy="comments") * @ORM\JoinColumn(onDelete="CASCADE") */ private $video; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="profil_comments") * @ORM\JoinColumn(onDelete="CASCADE") */ private $to_user; public function __construct() { $this->created_at = new \DateTimeImmutable(); $this->updated_at = new \DateTime(); } 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 getPhoto(): ?Photo { return $this->photo; } public function setPhoto(?Photo $photo): self { $this->photo = $photo; return $this; } public function getInfluencer(): ?Influencer { return $this->influencer; } public function setInfluencer(?Influencer $influencer): self { $this->influencer = $influencer; return $this; } public function getComment(): ?string { return $this->comment; } public function setComment(string $comment): self { $this->comment = $comment; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->created_at; } public function setCreatedAt(\DateTimeImmutable $created_at): self { $this->created_at = $created_at; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updated_at; } public function setUpdatedAt(\DateTimeInterface $updated_at): self { $this->updated_at = $updated_at; return $this; } public function getVideo(): ?Video { return $this->video; } public function setVideo(?Video $video): self { $this->video = $video; return $this; } public function getToUser(): ?User { return $this->to_user; } public function setToUser(?User $to_user): self { $this->to_user = $to_user; return $this; }}