src/Entity/Bus/Booking.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Bus;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JMS\Serializer\Annotation as Serializer;
  5. /**
  6. * Groups one or more BookingSeat rows created together as a single booking.
  7. *
  8. * Added as part of removing the Firestore-based pending-booking flow from the
  9. * imani_bus_app frontend: previously "a booking" (seats selected together,
  10. * paid for together, held before payment succeeds) only existed as a Firestore
  11. * document. This entity is the backend replacement for that concept.
  12. *
  13. * @ORM\Entity(repositoryClass="App\Repository\Bus\BookingRepository")
  14. * @ORM\Table(name="bus_booking")
  15. */
  16. class Booking
  17. {
  18. /**
  19. * @ORM\Id
  20. * @ORM\GeneratedValue(strategy="AUTO")
  21. * @ORM\Column(type="integer")
  22. */
  23. private $id;
  24. /**
  25. * Short, human-friendly reference shown to the passenger and used as the
  26. * M-Pesa transaction's ref_number for traceability.
  27. *
  28. * @ORM\Column(type="string", length=10, unique=true)
  29. */
  30. private $shortId;
  31. /**
  32. * @var Trip
  33. * @Serializer\Type("App\Entity\Bus\Trip")
  34. * @ORM\ManyToOne(targetEntity="App\Entity\Bus\Trip")
  35. * @ORM\JoinColumns({
  36. * @ORM\JoinColumn(name="trip_id", referencedColumnName="id", nullable=false)
  37. * })
  38. */
  39. private $trip;
  40. /**
  41. * @var Stop
  42. * @Serializer\Type("App\Entity\Bus\Stop")
  43. * @ORM\ManyToOne(targetEntity="App\Entity\Bus\Stop")
  44. * @ORM\JoinColumns({
  45. * @ORM\JoinColumn(name="origin_stop_id", referencedColumnName="id", nullable=false)
  46. * })
  47. */
  48. private $originStop;
  49. /**
  50. * @var Stop
  51. * @Serializer\Type("App\Entity\Bus\Stop")
  52. * @ORM\ManyToOne(targetEntity="App\Entity\Bus\Stop")
  53. * @ORM\JoinColumns({
  54. * @ORM\JoinColumn(name="destination_stop_id", referencedColumnName="id", nullable=false)
  55. * })
  56. */
  57. private $destinationStop;
  58. /**
  59. * Snapshot of the trip's travel date at booking time.
  60. *
  61. * @ORM\Column(type="datetime")
  62. */
  63. private $date;
  64. /**
  65. * @ORM\Column(type="integer")
  66. */
  67. private $totalPrice;
  68. /**
  69. * One of: pending, confirmed, failed.
  70. *
  71. * @ORM\Column(type="string", length=20)
  72. */
  73. private $status;
  74. /**
  75. * Device identifier sent by the app (Android WebView). Nullable because
  76. * historical/counter-originated bookings will never have one — only
  77. * bookings created through the online flow set this.
  78. *
  79. * @ORM\Column(type="string", length=100, nullable=true)
  80. */
  81. private $deviceId;
  82. /**
  83. * Payer's phone number. Not known at booking-creation time (the app
  84. * collects it later, at checkout, immediately before the STK push) —
  85. * populated once the M-Pesa callback provides it. May stay null for a
  86. * booking that fails before Safaricom returns any callback metadata.
  87. *
  88. * @ORM\Column(type="string", length=20, nullable=true)
  89. */
  90. private $phone;
  91. /**
  92. * @ORM\Column(type="datetime")
  93. */
  94. private $createdAt;
  95. /**
  96. * @ORM\Column(type="datetime", nullable=true)
  97. */
  98. private $updatedAt;
  99. public function getId()
  100. {
  101. return $this->id;
  102. }
  103. public function setId($id): void
  104. {
  105. $this->id = $id;
  106. }
  107. public function getShortId()
  108. {
  109. return $this->shortId;
  110. }
  111. public function setShortId($shortId): void
  112. {
  113. $this->shortId = $shortId;
  114. }
  115. public function getTrip(): Trip
  116. {
  117. return $this->trip;
  118. }
  119. public function setTrip(Trip $trip): void
  120. {
  121. $this->trip = $trip;
  122. }
  123. public function getOriginStop(): Stop
  124. {
  125. return $this->originStop;
  126. }
  127. public function setOriginStop(Stop $originStop): void
  128. {
  129. $this->originStop = $originStop;
  130. }
  131. public function getDestinationStop(): Stop
  132. {
  133. return $this->destinationStop;
  134. }
  135. public function setDestinationStop(Stop $destinationStop): void
  136. {
  137. $this->destinationStop = $destinationStop;
  138. }
  139. public function getDate()
  140. {
  141. return $this->date;
  142. }
  143. public function setDate($date): void
  144. {
  145. $this->date = $date;
  146. }
  147. public function getTotalPrice()
  148. {
  149. return $this->totalPrice;
  150. }
  151. public function setTotalPrice($totalPrice): void
  152. {
  153. $this->totalPrice = $totalPrice;
  154. }
  155. public function getStatus()
  156. {
  157. return $this->status;
  158. }
  159. public function setStatus($status): void
  160. {
  161. $this->status = $status;
  162. }
  163. public function getDeviceId()
  164. {
  165. return $this->deviceId;
  166. }
  167. public function setDeviceId($deviceId): void
  168. {
  169. $this->deviceId = $deviceId;
  170. }
  171. public function getPhone()
  172. {
  173. return $this->phone;
  174. }
  175. public function setPhone($phone): void
  176. {
  177. $this->phone = $phone;
  178. }
  179. public function getCreatedAt()
  180. {
  181. return $this->createdAt;
  182. }
  183. public function setCreatedAt($createdAt): void
  184. {
  185. $this->createdAt = $createdAt;
  186. }
  187. public function getUpdatedAt()
  188. {
  189. return $this->updatedAt;
  190. }
  191. public function setUpdatedAt($updatedAt): void
  192. {
  193. $this->updatedAt = $updatedAt;
  194. }
  195. }