src/Notification/Doctrine/Entity/Notification.php line 20

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Notification\Doctrine\Entity;
  4. use App\Notification\Doctrine\Repository\NotificationRepository;
  5. use App\Security\Doctrine\Entity\User;
  6. use DateTimeImmutable;
  7. use Doctrine\ORM\Mapping\Column;
  8. use Doctrine\ORM\Mapping\Entity;
  9. use Doctrine\ORM\Mapping\GeneratedValue;
  10. use Doctrine\ORM\Mapping\Id;
  11. use Doctrine\ORM\Mapping\JoinColumn;
  12. use Doctrine\ORM\Mapping\ManyToOne;
  13. use Doctrine\ORM\Mapping\Table;
  14. #[Entity(repositoryClassNotificationRepository::class)]
  15. #[Table(name'notification')]
  16. class Notification
  17. {
  18.     #[Id]
  19.     #[Column(type'integer')]
  20.     #[GeneratedValue]
  21.     private ?int $id null;
  22.     #[ManyToOne(targetEntityUser::class)]
  23.     #[JoinColumn(nullablefalseonDelete'CASCADE')]
  24.     private User $user;
  25.     #[Column(type'datetime_immutable')]
  26.     private DateTimeImmutable $sentAt;
  27.     #[Column(type'datetime_immutable'nullabletrue)]
  28.     private ?DateTimeImmutable $readAt null;
  29.     #[Column]
  30.     private string $content;
  31.     #[Column]
  32.     private string $route;
  33.     /**
  34.      * @var array<string, mixed>
  35.      */
  36.     #[Column(type'array')]
  37.     private array $routeParams = [];
  38.     #[Column]
  39.     private string $model;
  40.     public function __construct()
  41.     {
  42.         $this->sentAt = new DateTimeImmutable();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getUser(): User
  49.     {
  50.         return $this->user;
  51.     }
  52.     public function setUser(User $user): void
  53.     {
  54.         $this->user $user;
  55.     }
  56.     public function getSentAt(): DateTimeImmutable
  57.     {
  58.         return $this->sentAt;
  59.     }
  60.     public function setSentAt(DateTimeImmutable $sentAt): void
  61.     {
  62.         $this->sentAt $sentAt;
  63.     }
  64.     public function getReadAt(): ?DateTimeImmutable
  65.     {
  66.         return $this->readAt;
  67.     }
  68.     public function setReadAt(?DateTimeImmutable $readAt): void
  69.     {
  70.         $this->readAt $readAt;
  71.     }
  72.     public function getContent(): string
  73.     {
  74.         return $this->content;
  75.     }
  76.     public function setContent(string $content): void
  77.     {
  78.         $this->content $content;
  79.     }
  80.     public function getRoute(): string
  81.     {
  82.         return $this->route;
  83.     }
  84.     public function setRoute(string $route): void
  85.     {
  86.         $this->route $route;
  87.     }
  88.     /**
  89.      * @return array<string, mixed>
  90.      */
  91.     public function getRouteParams(): array
  92.     {
  93.         return $this->routeParams;
  94.     }
  95.     /**
  96.      * @param array<string, mixed> $routeParams
  97.      */
  98.     public function setRouteParams(array $routeParams): void
  99.     {
  100.         $this->routeParams $routeParams;
  101.     }
  102.     public function getModel(): string
  103.     {
  104.         return $this->model;
  105.     }
  106.     public function setModel(string $model): void
  107.     {
  108.         $this->model $model;
  109.     }
  110. }