src/Entity/Solicitud.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SolicitudRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=SolicitudRepository::class)
  9. */
  10. class Solicitud
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(type="date")
  20. */
  21. private $fechaDesde;
  22. /**
  23. * @ORM\Column(type="date")
  24. */
  25. private $fechaHasta;
  26. /**
  27. * @ORM\Column(type="integer")
  28. */
  29. private $adultos;
  30. /**
  31. * @ORM\Column(type="integer")
  32. */
  33. private $menores;
  34. /**
  35. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="solicitudes")
  36. */
  37. private $user;
  38. /**
  39. * @ORM\ManyToOne(targetEntity=Provider::class, inversedBy="solicitudes")
  40. */
  41. private $provider;
  42. /**
  43. * @ORM\Column(type="datetime_immutable")
  44. */
  45. private $createdAt;
  46. /**
  47. * @ORM\Column(type="boolean")
  48. */
  49. private $abierta;
  50. /**
  51. * @ORM\OneToMany(targetEntity=SolicitudLog::class, mappedBy="solicitud", cascade={"persist", "remove"})
  52. */
  53. private $logs;
  54. /**
  55. * @ORM\Column(type="boolean", nullable=true)
  56. */
  57. private $autorizaRespuesta;
  58. /**
  59. * @ORM\Column(type="string", length=1000, nullable=true)
  60. */
  61. private $comentarios;
  62. /**
  63. * @ORM\Column(type="string", length=255, nullable=true)
  64. */
  65. private $destino;
  66. /**
  67. * @ORM\Column(type="string", length=255, nullable=true)
  68. */
  69. private $cadena;
  70. /**
  71. * @return mixed
  72. */
  73. public function getDestino()
  74. {
  75. return $this->destino;
  76. }
  77. /**
  78. * @param mixed $destino
  79. */
  80. public function setDestino($destino): void
  81. {
  82. $this->destino = $destino;
  83. }
  84. /**
  85. * @return mixed
  86. */
  87. public function getCadena()
  88. {
  89. return $this->cadena;
  90. }
  91. /**
  92. * @param mixed $cadena
  93. */
  94. public function setCadena($cadena): void
  95. {
  96. $this->cadena = $cadena;
  97. }
  98. /**
  99. * @return mixed
  100. */
  101. public function getComentarios()
  102. {
  103. return $this->comentarios;
  104. }
  105. /**
  106. * @param mixed $comentarios
  107. */
  108. public function setComentarios($comentarios): void
  109. {
  110. $this->comentarios = $comentarios;
  111. }
  112. public function __construct()
  113. {
  114. $this->logs = new ArrayCollection();
  115. $this->createdAt = new \DateTimeImmutable();
  116. }
  117. public function getId(): ?int
  118. {
  119. return $this->id;
  120. }
  121. public function getFechaDesde(): ?\DateTimeInterface
  122. {
  123. return $this->fechaDesde;
  124. }
  125. public function setFechaDesde(\DateTimeInterface $fechaDesde): self
  126. {
  127. $this->fechaDesde = $fechaDesde;
  128. return $this;
  129. }
  130. public function getFechaHasta(): ?\DateTimeInterface
  131. {
  132. return $this->fechaHasta;
  133. }
  134. public function setFechaHasta(\DateTimeInterface $fechaHasta): self
  135. {
  136. $this->fechaHasta = $fechaHasta;
  137. return $this;
  138. }
  139. public function getAdultos(): ?int
  140. {
  141. return $this->adultos;
  142. }
  143. public function setAdultos(int $adultos): self
  144. {
  145. $this->adultos = $adultos;
  146. return $this;
  147. }
  148. public function getMenores(): ?int
  149. {
  150. return $this->menores;
  151. }
  152. public function setMenores(int $menores): self
  153. {
  154. $this->menores = $menores;
  155. return $this;
  156. }
  157. public function getUser(): ?User
  158. {
  159. return $this->user;
  160. }
  161. public function setUser(?User $user): self
  162. {
  163. $this->user = $user;
  164. return $this;
  165. }
  166. public function getProvider(): ?Provider
  167. {
  168. return $this->provider;
  169. }
  170. public function setProvider(?Provider $provider): self
  171. {
  172. $this->provider = $provider;
  173. return $this;
  174. }
  175. public function getCreatedAt(): ?\DateTimeImmutable
  176. {
  177. return $this->createdAt;
  178. }
  179. public function setCreatedAt(\DateTimeImmutable $createdAt): self
  180. {
  181. $this->createdAt = $createdAt;
  182. return $this;
  183. }
  184. public function isAbierta(): ?bool
  185. {
  186. return $this->abierta;
  187. }
  188. public function setAbierta(bool $abierta): self
  189. {
  190. $this->abierta = $abierta;
  191. return $this;
  192. }
  193. /**
  194. * @return Collection<int, SolicitudLog>
  195. */
  196. public function getLogs(): Collection
  197. {
  198. return $this->logs;
  199. }
  200. public function addLog(SolicitudLog $log): self
  201. {
  202. if (!$this->logs->contains($log)) {
  203. $this->logs[] = $log;
  204. $log->setSolicitud($this);
  205. }
  206. return $this;
  207. }
  208. public function removeLog(SolicitudLog $log): self
  209. {
  210. if ($this->logs->removeElement($log)) {
  211. // set the owning side to null (unless already changed)
  212. if ($log->getSolicitud() === $this) {
  213. $log->setSolicitud(null);
  214. }
  215. }
  216. return $this;
  217. }
  218. public function getLastLog()
  219. {
  220. return $this->getLogs()->last();
  221. }
  222. public function __toString()
  223. {
  224. return $this->id . ': ' . $this->getUser() . ': ' . $this->getProvider()->getNombreLocation();
  225. }
  226. /**
  227. * @return mixed
  228. */
  229. public function getAutorizaRespuesta()
  230. {
  231. return $this->autorizaRespuesta;
  232. }
  233. /**
  234. * @param mixed $autorizaRespuesta
  235. */
  236. public function setAutorizaRespuesta($autorizaRespuesta): void
  237. {
  238. $this->autorizaRespuesta = $autorizaRespuesta;
  239. }
  240. }