src/Entity/BitacoraUsuario.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BitacoraUsuarioRepository;
  4. use DateTime;
  5. use DateTimeInterface;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. #[ORM\Entity(repositoryClass: BitacoraUsuarioRepository::class)]
  10. class BitacoraUsuario
  11. {
  12. #[ORM\Id]
  13. #[ORM\GeneratedValue]
  14. #[ORM\Column]
  15. private ?int $id = null;
  16. #[ORM\ManyToOne(inversedBy: 'mensagesBitacora')]
  17. #[ORM\JoinColumn(nullable: false)]
  18. private ?Usuario $usuario = null;
  19. #[ORM\Column(type: Types::DATETIME_MUTABLE)]
  20. private DateTimeInterface $fechaHora;
  21. #[ORM\Column(type: Types::TEXT)]
  22. #[Assert\NotBlank]
  23. private ?string $mensaje = null;
  24. #[ORM\ManyToOne(inversedBy: 'mensajesBitacoraComoAutor')]
  25. #[ORM\JoinColumn(nullable: false)]
  26. private ?Usuario $autor = null;
  27. public function __construct()
  28. {
  29. $this->fechaHora = new DateTime();
  30. }
  31. public function getId(): ?int
  32. {
  33. return $this->id;
  34. }
  35. public function getUsuario(): ?Usuario
  36. {
  37. return $this->usuario;
  38. }
  39. public function setUsuario(?Usuario $usuario): static
  40. {
  41. $this->usuario = $usuario;
  42. return $this;
  43. }
  44. public function getFechaHora(): ?DateTimeInterface
  45. {
  46. return $this->fechaHora;
  47. }
  48. public function setFechaHora(DateTimeInterface $fechaHora): static
  49. {
  50. $this->fechaHora = $fechaHora;
  51. return $this;
  52. }
  53. public function getMensaje(): ?string
  54. {
  55. return $this->mensaje;
  56. }
  57. public function setMensaje(?string $mensaje): static
  58. {
  59. $this->mensaje = $mensaje;
  60. return $this;
  61. }
  62. public function getAutor(): ?Usuario
  63. {
  64. return $this->autor;
  65. }
  66. public function setAutor(?Usuario $autor): static
  67. {
  68. $this->autor = $autor;
  69. return $this;
  70. }
  71. }