src/Entity/EstadoReserva.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * @ORM\Entity
  8. */
  9. class EstadoReserva extends \App\Entity\BaseEntity
  10. {
  11. /**
  12. * @ORM\Id
  13. * @ORM\Column(type="integer")
  14. * @ORM\GeneratedValue(strategy="AUTO")
  15. */
  16. private $id;
  17. /**
  18. * @ORM\Column(type="string", nullable=true)
  19. */
  20. private $nombre;
  21. /**
  22. * @ORM\OneToMany(targetEntity=\App\Entity\Reserva::class, mappedBy="estadoReserva")
  23. */
  24. private $reservas;
  25. public function __construct()
  26. {
  27. $this->reservas = new ArrayCollection();
  28. }
  29. public function getId(): ?int
  30. {
  31. return $this->id;
  32. }
  33. public function setId($id)
  34. {
  35. $this->id = $id;
  36. return $this;
  37. }
  38. public function getNombre(): ?string
  39. {
  40. return $this->nombre;
  41. }
  42. public function setNombre(?string $nombre): static
  43. {
  44. $this->nombre = $nombre;
  45. return $this;
  46. }
  47. /**
  48. * @return Collection<int, Reserva>
  49. */
  50. public function getReservas(): Collection
  51. {
  52. return $this->reservas;
  53. }
  54. public function addReserva(Reserva $reserva): static
  55. {
  56. if (!$this->reservas->contains($reserva)) {
  57. $this->reservas->add($reserva);
  58. $reserva->setEstadoReserva($this);
  59. }
  60. return $this;
  61. }
  62. public function removeReserva(Reserva $reserva): static
  63. {
  64. if ($this->reservas->removeElement($reserva)) {
  65. // set the owning side to null (unless already changed)
  66. if ($reserva->getEstadoReserva() === $this) {
  67. $reserva->setEstadoReserva(null);
  68. }
  69. }
  70. return $this;
  71. }
  72. public function __toString(): string
  73. {
  74. return $this->nombre;
  75. }
  76. }