<?phpnamespace App\Entity;use App\Repository\ClientMessageRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: ClientMessageRepository::class)]class ClientMessage{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\ManyToOne(inversedBy: 'clientMessagesSent')] #[ORM\JoinColumn(nullable: false)] private ?Client $sender = null; #[ORM\Column(length: 255, nullable: true)] private ?string $subject = null; #[ORM\Column(type: Types::TEXT)] private ?string $message = null; #[ORM\Column] private ?\DateTime $createdAt = null; #[ORM\Column] private ?bool $messageRead = null; #[ORM\ManyToMany(targetEntity: Client::class, inversedBy: 'clientMessages')] private Collection $recipients; #[ORM\OneToOne(targetEntity: self::class, cascade: ['persist', 'remove'])] private ?self $replyMessage = null; public function __construct() { $this->recipients = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getSender(): ?Client { return $this->sender; } public function setSender(?Client $sender): static { $this->sender = $sender; return $this; } public function getSubject(): ?string { return $this->subject; } public function setSubject(?string $subject): static { $this->subject = $subject; return $this; } public function getMessage(): ?string { return $this->message; } public function setMessage(string $message): static { $this->message = $message; return $this; } public function getCreatedAt(): ?\DateTime { return $this->createdAt; } public function setCreatedAt(\DateTime $createdAt): static { $this->createdAt = $createdAt; return $this; } public function isMessageRead(): ?bool { return $this->messageRead; } public function setMessageRead(bool $messageRead): static { $this->messageRead = $messageRead; return $this; } /** * @return Collection<int, Client> */ public function getRecipients(): Collection { return $this->recipients; } public function addRecipient(Client $recipient): static { if (!$this->recipients->contains($recipient)) { $this->recipients->add($recipient); } return $this; } public function removeRecipient(Client $recipient): static { $this->recipients->removeElement($recipient); return $this; } public function getReplyMessage(): ?self { return $this->replyMessage; } public function setReplyMessage(?self $replyMessage): static { $this->replyMessage = $replyMessage; return $this; }}