['notification:read']], denormalizationContext: ['groups' => ['notification:write']], order: ['createdAt' => 'DESC'], )] #[ORM\Entity(repositoryClass: NotificationRepository::class)] #[ORM\Index(columns: ['user_id'], name: 'idx_notification_user')] #[ORM\Index(columns: ['user_id', 'is_read'], name: 'idx_notification_user_read')] class Notification { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] #[Groups(['notification:read'])] private ?int $id = null; #[ORM\ManyToOne(targetEntity: User::class)] #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] #[Groups(['notification:read'])] private ?User $user = null; #[ORM\Column(length: 50)] #[Groups(['notification:read'])] private ?string $type = null; #[ORM\Column(length: 255)] #[Groups(['notification:read'])] private ?string $title = null; #[ORM\Column(type: Types::TEXT)] #[Groups(['notification:read'])] private ?string $message = null; #[ORM\ManyToOne(targetEntity: ClientTicket::class)] #[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')] #[Groups(['notification:read'])] private ?ClientTicket $relatedTicket = null; #[ORM\Column] #[Groups(['notification:read', 'notification:write'])] private bool $isRead = false; #[ORM\Column] #[Groups(['notification:read'])] private ?DateTimeImmutable $createdAt = null; public function getId(): ?int { return $this->id; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): static { $this->user = $user; return $this; } public function getType(): ?string { return $this->type; } public function setType(string $type): static { $this->type = $type; return $this; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): static { $this->title = $title; return $this; } public function getMessage(): ?string { return $this->message; } public function setMessage(string $message): static { $this->message = $message; return $this; } public function getRelatedTicket(): ?ClientTicket { return $this->relatedTicket; } public function setRelatedTicket(?ClientTicket $relatedTicket): static { $this->relatedTicket = $relatedTicket; return $this; } public function isRead(): bool { return $this->isRead; } public function setIsRead(bool $isRead): static { $this->isRead = $isRead; return $this; } public function getCreatedAt(): ?DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(DateTimeImmutable $createdAt): static { $this->createdAt = $createdAt; return $this; } }