<?php
namespace App\Entity;
use DateTimeInterface;use App\Repository\NotificacionPushRepository;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
#[ORM\Entity(repositoryClass: NotificacionPushRepository::class)]class NotificacionPush
{
#[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] #[Serializer\Groups(groups: ['api'])] private $id;
#[ORM\ManyToOne(targetEntity: Usuario::class, inversedBy: 'notificacionesPushes')] #[ORM\JoinColumn(nullable: false)] private ?Usuario $usuario = null;
#[ORM\Column(type: 'string', length: 255)] #[Serializer\Groups(groups: ['api'])] private ?string $titulo = null;
#[ORM\Column(type: 'text')] #[Serializer\Groups(groups: ['api'])] private ?string $mensaje = null;
#[ORM\Column(type: 'datetime', nullable: true)] #[Serializer\Groups(groups: ['api'])] private ?DateTimeInterface $fechaLectura = null;
#[ORM\Column(type: 'datetime')] #[Serializer\Groups(groups: ['api'])] private DateTime|DateTimeInterface $fechaEnvio;
public function __construct()
{
$this->fechaEnvio = new DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getUsuario(): ?Usuario
{
return $this->usuario;
}
public function setUsuario(?Usuario $usuario): self
{
$this->usuario = $usuario;
return $this;
}
public function getTitulo(): ?string
{
return $this->titulo;
}
public function setTitulo(string $titulo): self
{
$this->titulo = $titulo;
return $this;
}
public function getMensaje(): ?string
{
return $this->mensaje;
}
public function setMensaje(string $mensaje): self
{
$this->mensaje = $mensaje;
return $this;
}
public function getFechaLectura(): ?DateTimeInterface
{
return $this->fechaLectura;
}
public function setFechaLectura(?DateTimeInterface $fechaLectura): self
{
$this->fechaLectura = $fechaLectura;
return $this;
}
public function getFechaEnvio(): ?DateTimeInterface
{
return $this->fechaEnvio;
}
public function setFechaEnvio(DateTimeInterface $fechaEnvio): self
{
$this->fechaEnvio = $fechaEnvio;
return $this;
}
// Esta propiedad se la pongo aquĆ para cuando serialice que me la ponga y no tenga que recorrer el array en el cliente #[Serializer\VirtualProperty] #[Serializer\Groups(groups: ['api'])] public function seleccionado(): bool {
return false;
}
}