src/Entity/NotificacionPush.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTimeInterface;
  4. use App\Repository\NotificacionPushRepository;
  5. use DateTime;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JMS\Serializer\Annotation as Serializer;
  8. #[ORM\Entity(repositoryClass: NotificacionPushRepository::class)]
  9. class NotificacionPush
  10. {
  11. #[ORM\Id]
  12. #[ORM\GeneratedValue]
  13. #[ORM\Column(type: 'integer')]
  14. #[Serializer\Groups(groups: ['api'])]
  15. private $id;
  16. #[ORM\ManyToOne(targetEntity: Usuario::class, inversedBy: 'notificacionesPushes')]
  17. #[ORM\JoinColumn(nullable: false)]
  18. private ?Usuario $usuario = null;
  19. #[ORM\Column(type: 'string', length: 255)]
  20. #[Serializer\Groups(groups: ['api'])]
  21. private ?string $titulo = null;
  22. #[ORM\Column(type: 'text')]
  23. #[Serializer\Groups(groups: ['api'])]
  24. private ?string $mensaje = null;
  25. #[ORM\Column(type: 'datetime', nullable: true)]
  26. #[Serializer\Groups(groups: ['api'])]
  27. private ?DateTimeInterface $fechaLectura = null;
  28. #[ORM\Column(type: 'datetime')]
  29. #[Serializer\Groups(groups: ['api'])]
  30. private DateTime|DateTimeInterface $fechaEnvio;
  31. public function __construct()
  32. {
  33. $this->fechaEnvio = new DateTime();
  34. }
  35. public function getId(): ?int
  36. {
  37. return $this->id;
  38. }
  39. public function getUsuario(): ?Usuario
  40. {
  41. return $this->usuario;
  42. }
  43. public function setUsuario(?Usuario $usuario): self
  44. {
  45. $this->usuario = $usuario;
  46. return $this;
  47. }
  48. public function getTitulo(): ?string
  49. {
  50. return $this->titulo;
  51. }
  52. public function setTitulo(string $titulo): self
  53. {
  54. $this->titulo = $titulo;
  55. return $this;
  56. }
  57. public function getMensaje(): ?string
  58. {
  59. return $this->mensaje;
  60. }
  61. public function setMensaje(string $mensaje): self
  62. {
  63. $this->mensaje = $mensaje;
  64. return $this;
  65. }
  66. public function getFechaLectura(): ?DateTimeInterface
  67. {
  68. return $this->fechaLectura;
  69. }
  70. public function setFechaLectura(?DateTimeInterface $fechaLectura): self
  71. {
  72. $this->fechaLectura = $fechaLectura;
  73. return $this;
  74. }
  75. public function getFechaEnvio(): ?DateTimeInterface
  76. {
  77. return $this->fechaEnvio;
  78. }
  79. public function setFechaEnvio(DateTimeInterface $fechaEnvio): self
  80. {
  81. $this->fechaEnvio = $fechaEnvio;
  82. return $this;
  83. }
  84. // Esta propiedad se la pongo aquĆ­ para cuando serialice que me la ponga y no tenga que recorrer el array en el cliente
  85. #[Serializer\VirtualProperty]
  86. #[Serializer\Groups(groups: ['api'])]
  87. public function seleccionado(): bool {
  88. return false;
  89. }
  90. }