<?phpnamespace App\Entity;use App\Repository\ContactRepository;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=ContactRepository::class) */class Contact{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=100) */ private $name; /** * @ORM\Column(type="string", length=180) */ private $email; /** * @ORM\Column(type="string", length=255) */ private $subject; /** * @ORM\Column(type="text") */ private $message; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=Instance::class) */ private $instance; /** * @return int|null */ public function getId(): ?int { return $this->id; } /** * @return string|null */ public function getName(): ?string { return $this->name; } /** * @param string $name * @return $this */ public function setName(string $name): self { $this->name = $name; return $this; } /** * @return string|null */ public function getEmail(): ?string { return $this->email; } /** * @param string $email * @return $this */ public function setEmail(string $email): self { $this->email = $email; return $this; } /** * @return string|null */ public function getSubject(): ?string { return $this->subject; } /** * @param string $subject * @return $this */ public function setSubject(string $subject): self { $this->subject = $subject; return $this; } /** * @return string|null */ public function getMessage(): ?string { return $this->message; } /** * @param string $message * @return $this */ public function setMessage(string $message): self { $this->message = $message; return $this; } public function getTruncatedMessage(): ?string { $stripped = strip_tags($this->message); return strlen($stripped) > 150 ? substr($stripped, 0, 150) . '...' : $stripped; } /** * @return \DateTimeInterface|null */ public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } /** * @param \DateTimeInterface $createdAt * @return $this */ public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } /** * @return string */ public function __toString() { return $this->getSubject().' ('.$this->getEmail().')'; } public function getInstance(): ?Instance { return $this->instance; } public function setInstance(?Instance $instance): self { $this->instance = $instance; return $this; }}