src/Entity/ChatMessage.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ChatMessageRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassChatMessageRepository::class)]
  7. #[ORM\HasLifecycleCallbacks]
  8. class ChatMessage
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\ManyToOne(inversedBy'chatMessages')]
  15.     #[ORM\JoinColumn(nullablefalse)]
  16.     private ?Eleve $student null;
  17.     #[ORM\Column(typeTypes::TEXT)]
  18.     private ?string $content null;
  19.     #[ORM\Column]
  20.     private ?bool $isFromAI null;
  21.     #[ORM\Column]
  22.     private ?\DateTimeImmutable $createdAt null;
  23.     #[ORM\ManyToOne]
  24.     #[ORM\JoinColumn(nullablefalse)]
  25.     private ?Categorie $subject null;
  26.     #[ORM\Column]
  27.     private bool $isRead false;
  28.     public function __construct()
  29.     {
  30.         $this->createdAt = new \DateTimeImmutable();
  31.         $this->isFromAI false;
  32.         $this->isRead false;
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getStudent(): ?Eleve
  39.     {
  40.         return $this->student;
  41.     }
  42.     public function setStudent(?Eleve $student): self
  43.     {
  44.         $this->student $student;
  45.         return $this;
  46.     }
  47.     public function getContent(): ?string
  48.     {
  49.         return $this->content;
  50.     }
  51.     public function setContent(string $content): self
  52.     {
  53.         $this->content $content;
  54.         return $this;
  55.     }
  56.     public function isFromAI(): ?bool
  57.     {
  58.         return $this->isFromAI;
  59.     }
  60.     public function setIsFromAI(bool $isFromAI): self
  61.     {
  62.         $this->isFromAI $isFromAI;
  63.         return $this;
  64.     }
  65.     public function getCreatedAt(): ?\DateTimeImmutable
  66.     {
  67.         return $this->createdAt;
  68.     }
  69.     #[ORM\PrePersist]
  70.     public function setCreatedAt(): self
  71.     {
  72.         $this->createdAt = new \DateTimeImmutable();
  73.         return $this;
  74.     }
  75.     public function getSubject(): ?Categorie
  76.     {
  77.         return $this->subject;
  78.     }
  79.     public function setSubject(?Categorie $subject): self
  80.     {
  81.         $this->subject $subject;
  82.         return $this;
  83.     }
  84.     public function isRead(): bool
  85.     {
  86.         return $this->isRead;
  87.     }
  88.     public function setIsRead(bool $isRead): self
  89.     {
  90.         $this->isRead $isRead;
  91.         return $this;
  92.     }
  93. }