src/Entity/ClientMessage.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ClientMessageRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassClientMessageRepository::class)]
  9. class ClientMessage
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\ManyToOne(inversedBy'clientMessagesSent')]
  16.     #[ORM\JoinColumn(nullablefalse)]
  17.     private ?Client $sender null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $subject null;
  20.     #[ORM\Column(typeTypes::TEXT)]
  21.     private ?string $message null;
  22.     #[ORM\Column]
  23.     private ?\DateTime $createdAt null;
  24.     #[ORM\Column]
  25.     private ?bool $messageRead null;
  26.     #[ORM\ManyToMany(targetEntityClient::class, inversedBy'clientMessages')]
  27.     private Collection $recipients;
  28.     #[ORM\OneToOne(targetEntityself::class, cascade: ['persist''remove'])]
  29.     private ?self $replyMessage null;
  30.     public function __construct()
  31.     {
  32.         $this->recipients = new ArrayCollection();
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getSender(): ?Client
  39.     {
  40.         return $this->sender;
  41.     }
  42.     public function setSender(?Client $sender): static
  43.     {
  44.         $this->sender $sender;
  45.         return $this;
  46.     }
  47.     public function getSubject(): ?string
  48.     {
  49.         return $this->subject;
  50.     }
  51.     public function setSubject(?string $subject): static
  52.     {
  53.         $this->subject $subject;
  54.         return $this;
  55.     }
  56.     public function getMessage(): ?string
  57.     {
  58.         return $this->message;
  59.     }
  60.     public function setMessage(string $message): static
  61.     {
  62.         $this->message $message;
  63.         return $this;
  64.     }
  65.     public function getCreatedAt(): ?\DateTime
  66.     {
  67.         return $this->createdAt;
  68.     }
  69.     public function setCreatedAt(\DateTime $createdAt): static
  70.     {
  71.         $this->createdAt $createdAt;
  72.         return $this;
  73.     }
  74.     public function isMessageRead(): ?bool
  75.     {
  76.         return $this->messageRead;
  77.     }
  78.     public function setMessageRead(bool $messageRead): static
  79.     {
  80.         $this->messageRead $messageRead;
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection<int, Client>
  85.      */
  86.     public function getRecipients(): Collection
  87.     {
  88.         return $this->recipients;
  89.     }
  90.     public function addRecipient(Client $recipient): static
  91.     {
  92.         if (!$this->recipients->contains($recipient)) {
  93.             $this->recipients->add($recipient);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeRecipient(Client $recipient): static
  98.     {
  99.         $this->recipients->removeElement($recipient);
  100.         return $this;
  101.     }
  102.     public function getReplyMessage(): ?self
  103.     {
  104.         return $this->replyMessage;
  105.     }
  106.     public function setReplyMessage(?self $replyMessage): static
  107.     {
  108.         $this->replyMessage $replyMessage;
  109.         return $this;
  110.     }
  111. }