src/Entity/UserNotification.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserNotificationRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Entity\Traits\Timestampable;
  7. use JMS\Serializer\Annotation\Groups;
  8. #[ORM\HasLifecycleCallbacks]
  9. #[ORM\Entity(repositoryClassUserNotificationRepository::class)]
  10. class UserNotification
  11. {
  12.     use Timestampable;
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     #[Groups(["getUserNotification"])]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     #[Groups(["getUserNotification"])]
  20.     private ?string $title null;
  21.     #[ORM\Column(length255)]
  22.     #[Groups(["getUserNotification"])]
  23.     private ?string $content null;
  24.     #[ORM\ManyToOne(inversedBy'userNotifications')]
  25.     #[ORM\JoinColumn(nullablefalse)]
  26.     #[Groups(["getUserNotification"])]
  27.     private ?User $user null;
  28.     #[ORM\Column(length255)]
  29.     #[Groups(["getUserNotification"])]
  30.     private ?string $type null;
  31.     #[ORM\Column(nullabletrue)]
  32.     #[Groups(["getUserNotification"])]
  33.     private ?int $dataId null;
  34.     #[ORM\Column(typeTypes::ARRAY, nullabletrue)]
  35.     #[Groups(["getUserNotification"])]
  36.     private ?array $data null;
  37.     // ── Champs ajoutés pour le système de notifs web ──────────────────────
  38.     #[ORM\Column(type'boolean'options: ['default' => false])]
  39.     #[Groups(["getUserNotification"])]
  40.     private bool $isRead false;
  41.     public function __construct()
  42.     {
  43.         $this->isRead    false;
  44.     }
  45.     // ── Getters/Setters existants ─────────────────────────────────────────
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getTitle(): ?string
  51.     {
  52.         return $this->title;
  53.     }
  54.     public function setTitle(string $title): static
  55.     {
  56.         $this->title $title;
  57.         return $this;
  58.     }
  59.     public function getContent(): ?string
  60.     {
  61.         return $this->content;
  62.     }
  63.     public function setContent(string $content): static
  64.     {
  65.         $this->content $content;
  66.         return $this;
  67.     }
  68.     public function getUser(): ?User
  69.     {
  70.         return $this->user;
  71.     }
  72.     public function setUser(?User $user): static
  73.     {
  74.         $this->user $user;
  75.         return $this;
  76.     }
  77.     public function getType(): ?string
  78.     {
  79.         return $this->type;
  80.     }
  81.     public function setType(string $type): static
  82.     {
  83.         $this->type $type;
  84.         return $this;
  85.     }
  86.     public function getDataId(): ?int
  87.     {
  88.         return $this->dataId;
  89.     }
  90.     public function setDataId(?int $dataId): static
  91.     {
  92.         $this->dataId $dataId;
  93.         return $this;
  94.     }
  95.     public function getData(): ?array
  96.     {
  97.         return $this->data;
  98.     }
  99.     public function setData(?array $data): static
  100.     {
  101.         $this->data $data;
  102.         return $this;
  103.     }
  104.     // ── Nouveaux getters/setters ──────────────────────────────────────────
  105.     public function getIsRead(): bool
  106.     {
  107.         return $this->isRead;
  108.     }
  109.     public function setIsRead(bool $isRead): static
  110.     {
  111.         $this->isRead $isRead;
  112.         return $this;
  113.     }
  114. }