src/Entity/ChatMessage.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ChatMessageRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=ChatMessageRepository::class)
  7.  * @ORM\Table(name="chat_message")
  8.  */
  9. class ChatMessage
  10. {
  11.     // Ã‰quivalent de l'Enum en PHP 7.4
  12.     const TYPE_TEXT 'text';
  13.     const TYPE_PDF 'pdf';
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="text", nullable=true)
  22.      */
  23.     private $content;
  24.     /**
  25.      * @ORM\Column(type="string", length=255, nullable=true)
  26.      */
  27.     private $fileName;
  28.     /**
  29.      * @ORM\Column(type="string", length=50, nullable=true)
  30.      */
  31.     private $fileSize;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, nullable=true)
  34.      */
  35.     private $pdfUrl;
  36.     /**
  37.      * @ORM\Column(type="datetime")
  38.      */
  39.     private $timestamp;
  40.     /**
  41.      * @ORM\Column(type="boolean")
  42.      */
  43.     private bool $isMe false;
  44.     /**
  45.      * @ORM\Column(type="string", length=20)
  46.      */
  47.     private $type;
  48.     /**
  49.      * @ORM\Column(type="string", length=100, nullable=true)
  50.      */
  51.     private $managerName;
  52.     /**
  53.      * @ORM\Column(type="string", length=50, nullable=true)
  54.      */
  55.     private $managerContact;
  56.     /**
  57.      * @ORM\Column(type="text", nullable=true)
  58.      */
  59.     private $comment;
  60.     /**
  61.      * @ORM\Column(type="string", length=50, nullable=true)
  62.      */
  63.     private $customerCode;
  64.     public function __construct()
  65.     {
  66.         $this->timestamp = new \DateTime();
  67.     }
  68.     // --- GETTERS & SETTERS ---
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getContent(): ?string
  74.     {
  75.         return $this->content;
  76.     }
  77.     public function setContent(?string $content): self
  78.     {
  79.         $this->content $content;
  80.         return $this;
  81.     }
  82.     public function getFileName(): ?string
  83.     {
  84.         return $this->fileName;
  85.     }
  86.     public function setFileName(?string $fileName): self
  87.     {
  88.         $this->fileName $fileName;
  89.         return $this;
  90.     }
  91.     public function getFileSize(): ?string
  92.     {
  93.         return $this->fileSize;
  94.     }
  95.     public function setFileSize(?string $fileSize): self
  96.     {
  97.         $this->fileSize $fileSize;
  98.         return $this;
  99.     }
  100.     public function getPdfUrl(): ?string
  101.     {
  102.         return $this->pdfUrl;
  103.     }
  104.     public function setPdfUrl(?string $pdfUrl): self
  105.     {
  106.         $this->pdfUrl $pdfUrl;
  107.         return $this;
  108.     }
  109.     public function getTimestamp(): \DateTimeInterface
  110.     {
  111.         return $this->timestamp;
  112.     }
  113.     public function setTimestamp(\DateTimeInterface $timestamp): self
  114.     {
  115.         $this->timestamp $timestamp;
  116.         return $this;
  117.     }
  118.     public function isMe(): bool
  119.     {
  120.         return $this->isMe;
  121.     }
  122.     public function setIsMe(bool $isMe): self
  123.     {
  124.         $this->isMe $isMe;
  125.         return $this;
  126.     }
  127.     public function getType(): ?string
  128.     {
  129.         return $this->type;
  130.     }
  131.     public function setType(string $type): self
  132.     {
  133.         if (!in_array($type, [self::TYPE_TEXTself::TYPE_PDF])) {
  134.             throw new \InvalidArgumentException("Type de message invalide");
  135.         }
  136.         $this->type $type;
  137.         return $this;
  138.     }
  139.     public function getManagerName(): ?string
  140.     {
  141.         return $this->managerName;
  142.     }
  143.     public function setManagerName(?string $managerName): self
  144.     {
  145.         $this->managerName $managerName;
  146.         return $this;
  147.     }
  148.     public function getManagerContact(): ?string
  149.     {
  150.         return $this->managerContact;
  151.     }
  152.     public function setManagerContact(?string $managerContact): self
  153.     {
  154.         $this->managerContact $managerContact;
  155.         return $this;
  156.     }
  157.     public function getComment(): ?string
  158.     {
  159.         return $this->comment;
  160.     }
  161.     public function setComment(?string $comment): self
  162.     {
  163.         $this->comment $comment;
  164.         return $this;
  165.     }
  166.     public function getCustomerCode(): ?string
  167.     {
  168.         return $this->customerCode;
  169.     }
  170.     public function setCustomerCode(?string $customerCode): self
  171.     {
  172.         $this->customerCode $customerCode;
  173.         return $this;
  174.     }
  175. }