src/AdminBundle/Entity/BookingRequest.php line 21

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Criteria;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints\DateTime;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use Doctrine\ORM\Mapping\OrderBy;
  9. #[ORM\Table(name: 'booking_request')]
  10. #[ORM\Index(name: 'status_date_index', columns: ['booking_status', 'pick_up_date', 'pick_up_time'])]
  11. #[ORM\Index(name: 'pickup_address_index', columns: ['pick_up_address', 'booking_status'])]
  12. #[ORM\Index(name: 'destination_address_index', columns: ['destination_address', 'booking_status'])]
  13. #[ORM\Index(name: 'client_first_name_index', columns: ['client_first_name', 'booking_status'])]
  14. #[ORM\Index(name: 'client_last_name_index', columns: ['client_last_name', 'booking_status'])]
  15. #[ORM\Index(name: 'client_email_index', columns: ['client_email', 'booking_status'])]
  16. #[ORM\Index(name: 'client_phone_index', columns: ['client_phone', 'booking_status'])]
  17. #[ORM\Entity(repositoryClass: \AdminBundle\Repository\BookingRequestRepository::class)]
  18. class BookingRequest extends BaseEntity
  19. {
  20. const STATUS_DELETED = 0;
  21. const STATUS_NEW_BOOKING = 1; //New booking in the web app system - not allocated/not dispatched
  22. const STATUS_DISPATCHED = 10; //Booking Dispatched to specific driver X
  23. const STATUS_DRIVER_REJECT = 11; //Driver X reject booking
  24. const STATUS_DRIVER_ACCEPT = 12; // Driver X accept booking
  25. const STATUS_ON_THE_WAY = 13; // The driver is on the way
  26. const STATUS_ARRIVED_AND_WAITING = 14; // The driver arrived and waiting passenger
  27. const STATUS_PASSENGER_ON_BOARD = 15; // Passenger up to car
  28. const STATUS_ABOUT_TO_DROP = 16; // almost at destination
  29. const STATUS_COMPLETED = 17;
  30. const STATUS_BROADCAST = 20; // booking sent to all available / qualified drivers
  31. const STATUS_ARCHIVED = 21; // booking sent to archive
  32. const STATUS_DEALLOCATED_ON_DEMAND = 25; //Before pick up
  33. const STATUS_DEALLOCATED_LATE_PICKUP = 26; //Before pick up
  34. const STATUS_DEALLOCATED_NO_LONGER_AVAILABLE = 27; //Before pick up
  35. const STATUS_DEALLOCATED_CAR_BROKE_DOWN = 28; //Before pick up
  36. const STATUS_DEALLOCATED_OFFICE = 29; //Before pick up
  37. const STATUS_CANCELLED_OTHER_REASON = 30; //Cancellation with no defined reason
  38. const STATUS_CLIENT_CANCELLATION = 31;
  39. const STATUS_CLIENT_NOT_SHOW_UP = 32;
  40. const STATUS_CAR_BROKE_DOWN = 33; // the part with timer
  41. const STATUS_OFFICE_CANCELLATION = 34; //headquarter initiated cancellation
  42. const STATUS_PENDING = 90; //New booking but not paid ( external sources - website )
  43. const STATUS_PENDING_CANCELLATION = 91; //Special status from the office due to non payment
  44. static $statusTypes = [
  45. self::STATUS_DELETED => 'Deleted',
  46. self::STATUS_NEW_BOOKING => 'New booking',
  47. self::STATUS_DISPATCHED => 'Dispatched',
  48. self::STATUS_DRIVER_REJECT => 'Dispatched reject',
  49. self::STATUS_DRIVER_ACCEPT => 'Dispatched accept',
  50. self::STATUS_ON_THE_WAY => 'On the way',
  51. self::STATUS_ARRIVED_AND_WAITING => 'Arrived and waiting',
  52. self::STATUS_PASSENGER_ON_BOARD => 'Passenger on board',
  53. self::STATUS_ABOUT_TO_DROP => 'About to drop',
  54. self::STATUS_COMPLETED => 'Completed',
  55. self::STATUS_ARCHIVED => 'Archived',
  56. self::STATUS_BROADCAST => 'ASAP Notification',
  57. self::STATUS_DEALLOCATED_ON_DEMAND => 'Deallocated on demand',
  58. self::STATUS_DEALLOCATED_LATE_PICKUP => 'Deallocated - Late for pickup',
  59. self::STATUS_DEALLOCATED_NO_LONGER_AVAILABLE => 'Deallocated - No longer available',
  60. self::STATUS_DEALLOCATED_CAR_BROKE_DOWN => 'Deallocated - Car broke down',
  61. self::STATUS_DEALLOCATED_OFFICE => 'Deallocated - Office Deallocation',
  62. self::STATUS_CANCELLED_OTHER_REASON => 'Cancelled Other Reason',
  63. self::STATUS_CLIENT_CANCELLATION => 'Client cancellation',
  64. self::STATUS_CLIENT_NOT_SHOW_UP => 'Client didn’t show up',
  65. self::STATUS_CAR_BROKE_DOWN => 'Car broke down',
  66. self::STATUS_OFFICE_CANCELLATION => 'Office cancellation',
  67. self::STATUS_PENDING => 'Pending',
  68. self::STATUS_PENDING_CANCELLATION => 'Pending Cancellation'
  69. ];
  70. /**
  71. * @var integer
  72. */
  73. #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
  74. #[ORM\Id]
  75. #[ORM\GeneratedValue(strategy: 'IDENTITY')]
  76. protected $id;
  77. /**
  78. * @var string
  79. */
  80. #[ORM\Column(name: 'booking_key', type: 'string', length: 255, nullable: false, unique: true)]
  81. protected $key;
  82. /**
  83. * @var string
  84. */
  85. #[ORM\Column(name: 'booking_created_key', type: 'string', length: 255, nullable: true)]
  86. protected $bookingCreatedKey;
  87. /**
  88. * @var integer
  89. */
  90. #[ORM\Column(name: 'booking_status', type: 'integer')]
  91. protected $status = self::STATUS_BROADCAST;
  92. /**
  93. * @var integer
  94. */
  95. #[ORM\Column(name: 'drivers_confirmed_number', type: 'integer')]
  96. protected $driversConfirmedNumber = 0;
  97. /**
  98. * @var CarType
  99. */
  100. #[ORM\JoinColumn(name: 'car_type_id', referencedColumnName: 'id')]
  101. #[ORM\ManyToOne(targetEntity: \AdminBundle\Entity\CarType::class)]
  102. protected $carType;
  103. /**
  104. * @var float
  105. */
  106. #[ORM\Column(name: 'quote_price', type: 'decimal', precision: 7, scale: 2, nullable: true)]
  107. #[Assert\NotBlank]
  108. protected $quotePrice = 0;
  109. /**
  110. * @var float
  111. */
  112. #[ORM\Column(name: 'override_price', type: 'decimal', precision: 7, scale: 2, nullable: true)]
  113. protected $overridePrice = 0;
  114. /**
  115. * @var string
  116. */
  117. #[ORM\Column(name: 'flight_number', type: 'string', length: 260, nullable: true)]
  118. protected $flightNumber;
  119. /**
  120. * @var \DateTime
  121. */
  122. #[ORM\Column(name: 'flight_landing_time', type: 'time', nullable: true)]
  123. protected $flightLandingTime;
  124. /**
  125. * @var \DateTime
  126. */
  127. #[ORM\Column(name: 'waiting_time', type: 'time', nullable: true)]
  128. protected $waitingTime;
  129. /**
  130. * @var \DateTime
  131. */
  132. #[ORM\Column(name: 'job_waiting_time', type: 'time', nullable: true)]
  133. protected $jobWaitingTime;
  134. /**
  135. * @var string
  136. */
  137. #[ORM\Column(name: 'return_flight_number', type: 'string', length: 260, nullable: true)]
  138. protected $returnFlightNumber;
  139. /**
  140. * @var \DateTime
  141. */
  142. #[ORM\Column(name: 'return_flight_landing_time', type: 'time', nullable: true)]
  143. protected $returnFlightLandingTime;
  144. /**
  145. * @var float
  146. */
  147. #[ORM\Column(name: 'driver_price', type: 'decimal', precision: 7, scale: 2, nullable: true)]
  148. protected $driverPrice;
  149. /**
  150. * @var float
  151. */
  152. #[ORM\Column(name: 'return_driver_price', type: 'decimal', precision: 7, scale: 2, nullable: true)]
  153. protected $returnDriverPrice;
  154. /**
  155. * @var float
  156. */
  157. #[ORM\Column(name: 'distance_unit', type: 'float', nullable: true)]
  158. #[Assert\NotBlank]
  159. protected $distanceUnit;
  160. /**
  161. * @var string
  162. */
  163. #[Assert\NotBlank]
  164. #[ORM\Column(name: 'estimated_time', type: 'text', nullable: true, length: 255)]
  165. protected $estimatedTime;
  166. /**
  167. * @var \DateTime
  168. */
  169. #[ORM\Column(name: 'booking_date', type: 'datetime', nullable: true)]
  170. protected $bookingDate;
  171. /**
  172. * @var \DateTime
  173. */
  174. #[ORM\Column(name: 'expire_broadcast_date', type: 'datetime', nullable: true)]
  175. protected $expireBroadcastDate;
  176. /**
  177. * @var Driver
  178. */
  179. #[ORM\JoinColumn(name: 'driver_id', referencedColumnName: 'id')]
  180. #[ORM\ManyToOne(targetEntity: \Driver::class, inversedBy: 'bookings_request')]
  181. protected $driver;
  182. /**
  183. * @var Car
  184. */
  185. #[ORM\JoinColumn(name: 'car_id', referencedColumnName: 'id')]
  186. #[ORM\ManyToOne(targetEntity: \Car::class)]
  187. protected $car;
  188. /**
  189. * @var string
  190. */
  191. #[ORM\Column(name: 'pick_up_address', type: 'string', length: 255, nullable: false)]
  192. protected $pickUpAddress;
  193. /**
  194. * @var float
  195. */
  196. #[ORM\Column(name: 'pmg', type: 'decimal', precision: 7, scale: 2, nullable: true)]
  197. protected $pmg;
  198. /**
  199. * @var float
  200. */
  201. #[ORM\Column(name: 'return_pmg', type: 'decimal', precision: 7, scale: 2, nullable: true)]
  202. protected $returnPmg;
  203. /**
  204. * @var float
  205. */
  206. #[ORM\Column(name: 'pick_up_lat', type: 'float', precision: 10, scale: 6, nullable: true)]
  207. protected $pickUpLat;
  208. /**
  209. * @var float
  210. */
  211. #[ORM\Column(name: 'pick_up_lng', type: 'float', precision: 10, scale: 6, nullable: true)]
  212. protected $pickUpLng;
  213. /**
  214. * @var string
  215. */
  216. #[ORM\Column(name: 'pick_up_post_code', type: 'string', length: 10)]
  217. protected $pickUpPostCode;
  218. /**
  219. * @var \DateTime
  220. */
  221. #[ORM\Column(name: 'pick_up_date', type: 'datetime', nullable: false)]
  222. protected $pickUpDate;
  223. /**
  224. * @var \DateTime
  225. */
  226. #[ORM\Column(name: 'pick_up_time', type: 'time', nullable: false)]
  227. protected $pickUpTime;
  228. /**
  229. * @var \DateTime
  230. */
  231. #[ORM\Column(name: 'pick_up_date_time', type: 'datetime', nullable: true)]
  232. protected $pickUpDateTime;
  233. /**
  234. * @var \DateTime
  235. */
  236. #[ORM\Column(name: 'return_pick_up_date', type: 'datetime', nullable: true)]
  237. protected $returnPickUpDate;
  238. /**
  239. * @var \DateTime
  240. */
  241. #[ORM\Column(name: 'return_pick_up_time', type: 'time', nullable: true)]
  242. protected $returnPickUpTime;
  243. /**
  244. * @var string
  245. */
  246. #[ORM\Column(name: 'destination_address', type: 'string', length: 255, nullable: false)]
  247. protected $destinationAddress;
  248. /**
  249. * @var float
  250. */
  251. #[ORM\Column(name: 'destination_lat', type: 'float', precision: 10, scale: 6, nullable: true)]
  252. protected $destinationLat;
  253. /**
  254. * @var float
  255. */
  256. #[ORM\Column(name: 'destination_lng', type: 'float', precision: 10, scale: 6, nullable: true)]
  257. protected $destinationLng;
  258. /**
  259. * @var string
  260. */
  261. #[ORM\Column(name: 'destination_post_code', type: 'string', length: 10)]
  262. protected $destinationPostCode;
  263. /**
  264. * @var integer
  265. */
  266. #[ORM\Column(name: 'passengers_number', type: 'integer', nullable: true)]
  267. protected $passengersNumber = 1;
  268. /**
  269. * @var string
  270. */
  271. #[ORM\Column(name: 'hand_luggage', type: 'string', length: 64, nullable: true)]
  272. protected $handLuggage = 0;
  273. /**
  274. * @var string
  275. */
  276. #[ORM\Column(name: 'checkin_luggage', type: 'string', length: 64, nullable: true)]
  277. protected $checkinLuggage = 0;
  278. /**
  279. * @var string
  280. */
  281. #[ORM\Column(name: 'notes', type: 'text', nullable: true)]
  282. protected $notes;
  283. /**
  284. * @var string
  285. */
  286. #[ORM\Column(name: 'return_booking_notes', type: 'text', nullable: true)]
  287. protected $returnBookingNotes;
  288. /**
  289. * @var string
  290. */
  291. #[ORM\Column(name: 'client_first_name', type: 'string', length: 64, nullable: true)]
  292. protected $clientFirstName;
  293. /**
  294. * @var string
  295. */
  296. #[ORM\Column(name: 'client_last_name', type: 'string', length: 64, nullable: true)]
  297. protected $clientLastName;
  298. /**
  299. * @var string
  300. */
  301. #[ORM\Column(name: 'client_phone', type: 'string', length: 64, nullable: true)]
  302. protected $clientPhone;
  303. /**
  304. * @var string
  305. */
  306. #[ORM\Column(name: 'client_email', type: 'string', length: 64, nullable: true)]
  307. protected $clientEmail;
  308. /**
  309. * @var string
  310. */
  311. #[ORM\Column(name: 'client_alternative_phone', type: 'string', length: 64, nullable: true)]
  312. protected $clientAlternativePhone;
  313. /**
  314. * @var string
  315. */
  316. #[ORM\Column(name: 'client_alternative_email', type: 'string', length: 64, nullable: true)]
  317. protected $clientAlternativeEmail;
  318. /**
  319. * @var ArrayCollection
  320. */
  321. #[ORM\OneToMany(targetEntity: \BookingViasAddress::class, mappedBy: 'bookingRequest', cascade: ['persist', 'remove'], orphanRemoval: true)]
  322. protected $vias;
  323. #[ORM\OneToMany(targetEntity: \BookingBookingExtra::class, mappedBy: 'bookingRequest', cascade: ['persist'])]
  324. protected $extras;
  325. /**
  326. * @var User
  327. */
  328. #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: true)]
  329. #[ORM\ManyToOne(targetEntity: \User::class, cascade: ['all'])]
  330. protected $clientUser;
  331. /**
  332. * @var string
  333. */
  334. #[ORM\Column(name: 'voucher_code', type: 'string', length: 64, nullable: true)]
  335. protected $voucherCode;
  336. /**
  337. * @var string
  338. */
  339. #[ORM\Column(name: 'voucher_value', type: 'decimal', precision: 7, scale: 2, nullable: true)]
  340. protected $voucherValue;
  341. /**
  342. * @var boolean
  343. */
  344. #[ORM\Column(name: 'create_account', type: 'boolean')]
  345. private $createAccount = true;
  346. /**
  347. * @var BookingRequest
  348. */
  349. #[ORM\JoinColumn(name: 'return_booking_request_id', referencedColumnName: 'id')]
  350. #[ORM\OneToOne(targetEntity: \BookingRequest::class, inversedBy: 'parentBooking', cascade: ['persist', 'remove'])]
  351. protected $returnBooking;
  352. /**
  353. * @var BookingRequest
  354. */
  355. #[ORM\OneToOne(targetEntity: \BookingRequest::class, mappedBy: 'returnBooking')]
  356. protected $parentBooking;
  357. /**
  358. * @var string
  359. */
  360. #[ORM\Column(name: 'booking_data_serialized', type: 'json', nullable: true)]
  361. private $bookingDataSerialized;
  362. /**
  363. * @var string
  364. */
  365. #[ORM\Column(name: 'notified_drivers', type: 'text', nullable: true)]
  366. protected $notifiedDrivers;
  367. public function __construct()
  368. {
  369. $this->driversConfirmedNumber = 0;
  370. $this->bookingDate = new \DateTime();
  371. $this->vias = new ArrayCollection();
  372. $this->extras = new ArrayCollection();
  373. $this->generateKey();
  374. }
  375. public function generateKey()
  376. {
  377. $length = 8;
  378. $this->setKey(strtoupper(substr(md5(uniqid()), mt_rand(0,31 - $length), $length)));
  379. }
  380. /**
  381. * @return int
  382. */
  383. public function getId()
  384. {
  385. return $this->id;
  386. }
  387. /**
  388. * @param int $id
  389. */
  390. public function setId($id)
  391. {
  392. $this->id = $id;
  393. }
  394. /**
  395. * @return string
  396. */
  397. public function getKey()
  398. {
  399. return $this->key;
  400. }
  401. /**
  402. * @param string $key
  403. */
  404. public function setKey($key)
  405. {
  406. $this->key = $key;
  407. }
  408. /**
  409. * @return \DateTime
  410. */
  411. public function getExpireBroadcastDate()
  412. {
  413. return $this->expireBroadcastDate;
  414. }
  415. /**
  416. * @param \DateTime $expireBroadcastDate
  417. */
  418. public function setExpireBroadcastDate($expireBroadcastDate)
  419. {
  420. $this->expireBroadcastDate = $expireBroadcastDate;
  421. }
  422. /**
  423. * @return float
  424. */
  425. public function getQuotePrice()
  426. {
  427. return $this->quotePrice;
  428. }
  429. /**
  430. * @param float $quotePrice
  431. */
  432. public function setQuotePrice($quotePrice)
  433. {
  434. $this->quotePrice = $quotePrice;
  435. }
  436. /**
  437. * @return float
  438. */
  439. public function getOverridePrice()
  440. {
  441. return $this->overridePrice;
  442. }
  443. /**
  444. * @param float $overridePrice
  445. */
  446. public function setOverridePrice($overridePrice)
  447. {
  448. $this->overridePrice = $overridePrice;
  449. }
  450. /**
  451. * @return float
  452. */
  453. public function getDriverPrice()
  454. {
  455. return $this->driverPrice;
  456. }
  457. /**
  458. * @param float $driverPrice
  459. */
  460. public function setDriverPrice($driverPrice)
  461. {
  462. $this->driverPrice = $driverPrice;
  463. }
  464. /**
  465. * @return float
  466. */
  467. public function getReturnDriverPrice()
  468. {
  469. return $this->returnDriverPrice;
  470. }
  471. /**
  472. * @param float $returnDriverPrice
  473. */
  474. public function setReturnDriverPrice($returnDriverPrice)
  475. {
  476. $this->returnDriverPrice = $returnDriverPrice;
  477. }
  478. /**
  479. * @return \DateTime
  480. */
  481. public function getBookingDate()
  482. {
  483. return $this->bookingDate;
  484. }
  485. /**
  486. * @param \DateTime $bookingDate
  487. */
  488. public function setBookingDate($bookingDate)
  489. {
  490. $this->bookingDate = $bookingDate;
  491. }
  492. /**
  493. * @return int
  494. */
  495. public function getStatus()
  496. {
  497. return $this->status;
  498. }
  499. /**
  500. * @param int $status
  501. */
  502. public function setStatus($status)
  503. {
  504. $this->status = $status;
  505. }
  506. /**
  507. * @return int
  508. */
  509. public function getDriversConfirmedNumber()
  510. {
  511. return $this->driversConfirmedNumber;
  512. }
  513. /**
  514. * @param int $driversConfirmedNumber
  515. */
  516. public function setDriversConfirmedNumber($driversConfirmedNumber)
  517. {
  518. $this->driversConfirmedNumber = $driversConfirmedNumber;
  519. }
  520. public function incrementDriversConfirmedNumber()
  521. {
  522. $this->driversConfirmedNumber++;
  523. }
  524. /**
  525. * @return mixed
  526. */
  527. public function getRoundTripBookingId()
  528. {
  529. return $this->roundTripBookingId;
  530. }
  531. /**
  532. * @param mixed $roundTripBookingId
  533. */
  534. public function setRoundTripBookingId($roundTripBookingId)
  535. {
  536. $this->roundTripBookingId = $roundTripBookingId;
  537. }
  538. /**
  539. * @return Driver
  540. */
  541. public function getDriver()
  542. {
  543. return $this->driver;
  544. }
  545. /**
  546. * @param mixed $driver
  547. */
  548. public function setDriver($driver)
  549. {
  550. $this->driver = $driver;
  551. }
  552. /**
  553. * @return Car
  554. */
  555. public function getCar()
  556. {
  557. return $this->car;
  558. }
  559. /**
  560. * @param mixed $car
  561. */
  562. public function setCar($car)
  563. {
  564. $this->car = $car;
  565. }
  566. /**
  567. * @return mixed
  568. */
  569. public function getExtras()
  570. {
  571. return $this->extras;
  572. }
  573. /**
  574. * @param ArrayCollection $extras
  575. */
  576. public function setExtras($extras)
  577. {
  578. $this->extras = $extras;
  579. }
  580. public function addExtra($extra)
  581. {
  582. $this->extras->add($extra);
  583. }
  584. /**
  585. * @return string
  586. */
  587. public function getPickUpAddress()
  588. {
  589. return $this->pickUpAddress;
  590. }
  591. /**
  592. * @param string $pickUpAddress
  593. */
  594. public function setPickUpAddress($pickUpAddress)
  595. {
  596. $this->pickUpAddress = $pickUpAddress;
  597. }
  598. /**
  599. * @return string
  600. */
  601. public function getPickUpTime($timeFormat = 'H:i')
  602. {
  603. if (! $this->pickUpTime) {
  604. return ;
  605. }
  606. return $this->pickUpTime->format($timeFormat);
  607. }
  608. /**
  609. * @param \DateTime|string $pickUpTime
  610. */
  611. public function setPickUpTime($pickUpTime)
  612. {
  613. if (is_string($pickUpTime)) {
  614. $timeArray = explode(':', $pickUpTime);
  615. $pickUpTime = new \DateTime();
  616. $pickUpTime->setTime(
  617. intval($timeArray[0]),
  618. intval($timeArray[1])
  619. );
  620. }
  621. $this->pickUpTime = $pickUpTime;
  622. $this->updatePickUpDateTime();
  623. }
  624. /**
  625. * @return \DateTime
  626. */
  627. public function getPickUpDateTime()
  628. {
  629. return $this->pickUpDateTime;
  630. }
  631. /**
  632. * @return string
  633. */
  634. public function getDestinationAddress()
  635. {
  636. return $this->destinationAddress;
  637. }
  638. /**
  639. * @param string $destinationAddress
  640. */
  641. public function setDestinationAddress($destinationAddress)
  642. {
  643. $this->destinationAddress = $destinationAddress;
  644. }
  645. /**
  646. * @return int
  647. */
  648. public function getPassengersNumber()
  649. {
  650. return $this->passengersNumber;
  651. }
  652. /**
  653. * @param int $passengersNumber
  654. */
  655. public function setPassengersNumber($passengersNumber)
  656. {
  657. $this->passengersNumber = $passengersNumber;
  658. }
  659. public function getStringStatus($statusType)
  660. {
  661. return self::$statusTypes[$statusType];
  662. }
  663. /**
  664. * @return string
  665. */
  666. public function getHandLuggage()
  667. {
  668. return $this->handLuggage;
  669. }
  670. /**
  671. * @param string $handLuggage
  672. */
  673. public function setHandLuggage($handLuggage)
  674. {
  675. $this->handLuggage = $handLuggage;
  676. }
  677. /**
  678. * @return string
  679. */
  680. public function getCheckinLuggage()
  681. {
  682. return $this->checkinLuggage;
  683. }
  684. /**
  685. * @param string $checkinLuggage
  686. */
  687. public function setCheckinLuggage($checkinLuggage)
  688. {
  689. $this->checkinLuggage = $checkinLuggage;
  690. }
  691. /**
  692. * @return string
  693. */
  694. public function getNotes()
  695. {
  696. return $this->notes;
  697. }
  698. /**
  699. * @param string $notes
  700. */
  701. public function setNotes($notes)
  702. {
  703. $this->notes = $notes;
  704. }
  705. /**
  706. * @return User
  707. */
  708. public function getClientUser()
  709. {
  710. return $this->clientUser;
  711. }
  712. /**
  713. * @param User $clientUser
  714. */
  715. public function setClientUser($clientUser)
  716. {
  717. $this->clientUser = $clientUser;
  718. }
  719. /**
  720. * @return string
  721. */
  722. public function getReturnFlightNumber()
  723. {
  724. return $this->returnFlightNumber;
  725. }
  726. /**
  727. * @param string $returnFlightNumber
  728. */
  729. public function setReturnFlightNumber($returnFlightNumber)
  730. {
  731. $this->returnFlightNumber = $returnFlightNumber;
  732. }
  733. /**
  734. * @return string
  735. */
  736. public function getReturnFlightLandingTime()
  737. {
  738. if (! $this->returnFlightLandingTime) {
  739. return ;
  740. }
  741. return $this->returnFlightLandingTime->format('H:i');
  742. }
  743. /**
  744. * @param \DateTime|string $returnFlightLandingTime
  745. */
  746. public function setReturnFlightLandingTime($returnFlightLandingTime)
  747. {
  748. if (is_string($returnFlightLandingTime)) {
  749. $timeArray = explode(':', $returnFlightLandingTime);
  750. $returnFlightLandingTime = new \DateTime();
  751. $returnFlightLandingTime->setTime(
  752. intval($timeArray[0]),
  753. intval($timeArray[1])
  754. );
  755. }
  756. $this->returnFlightLandingTime = $returnFlightLandingTime;
  757. }
  758. /**
  759. * @return \DateTime
  760. */
  761. public function getReturnPickUpDate()
  762. {
  763. return $this->returnPickUpDate;
  764. }
  765. /**
  766. * @param \DateTime $returnPickUpDate
  767. */
  768. public function setReturnPickUpDate($returnPickUpDate)
  769. {
  770. $this->returnPickUpDate = $returnPickUpDate;
  771. }
  772. /**
  773. * @return string
  774. */
  775. public function getReturnPickUpTime()
  776. {
  777. if (! $this->returnPickUpTime) {
  778. return ;
  779. }
  780. return $this->returnPickUpTime->format('H:i');
  781. }
  782. /**
  783. * @param \DateTime $returnPickUpTime
  784. */
  785. public function setReturnPickUpTime($returnPickUpTime)
  786. {
  787. if (is_string($returnPickUpTime)) {
  788. $timeArray = explode(':', $returnPickUpTime);
  789. $returnPickUpTime = new \DateTime();
  790. $returnPickUpTime->setTime(
  791. intval($timeArray[0]),
  792. intval($timeArray[1])
  793. );
  794. }
  795. $this->returnPickUpTime = $returnPickUpTime;
  796. }
  797. /**
  798. * @return string
  799. */
  800. public function getReturnBookingNotes()
  801. {
  802. return $this->returnBookingNotes;
  803. }
  804. /**
  805. * @param string $returnBookingNotes
  806. */
  807. public function setReturnBookingNotes($returnBookingNotes)
  808. {
  809. $this->returnBookingNotes = $returnBookingNotes;
  810. }
  811. /**
  812. * @param boolean $toSecond
  813. * @return \DateTime|int
  814. */
  815. public function getWaitingTime($toSecond = false)
  816. {
  817. if ($toSecond) {
  818. return empty($this->waitingTime) ? 0 : (intval($this->waitingTime->format('H')) * 3600) +
  819. (intval($this->waitingTime->format('i')) * 60) +
  820. intval($this->waitingTime->format('s'));
  821. }
  822. return $this->waitingTime;
  823. }
  824. public function getMgMinutes()
  825. {
  826. if (! $this->flightLandingTime) {
  827. return 0;
  828. }
  829. $pickUpTimeComponents = explode(':', $this->pickUpTime->format('H:i'));
  830. $pickUpTimeInMinutes = intval($pickUpTimeComponents[1]) + (intval($pickUpTimeComponents[0]) * 60);
  831. $flightLandingTimeComponents = explode(':', $this->flightLandingTime->format('H:i'));
  832. $flightLandingTimeInMinutes = intval($flightLandingTimeComponents[1]) + (intval($flightLandingTimeComponents[0]) * 60);
  833. if ($flightLandingTimeInMinutes <= $pickUpTimeInMinutes ) {
  834. return 0;
  835. }
  836. return ($flightLandingTimeInMinutes - $pickUpTimeInMinutes);
  837. }
  838. /**
  839. * @param \DateTime $waitingTime
  840. */
  841. public function setWaitingTime($waitingTime)
  842. {
  843. $this->waitingTime = $waitingTime;
  844. }
  845. /**
  846. * @param bool $toSecond
  847. * @return \DateTime
  848. */
  849. public function getJobWaitingTime($toSecond = false)
  850. {
  851. if ($toSecond) {
  852. return empty($this->jobWaitingTime) ? 0 : (intval($this->jobWaitingTime->format('H')) * 3600) +
  853. (intval($this->jobWaitingTime->format('i')) * 60) +
  854. intval($this->jobWaitingTime->format('s'));
  855. }
  856. return $this->jobWaitingTime;
  857. }
  858. /**
  859. * @param \DateTime $jobWaitingTime
  860. */
  861. public function setJobWaitingTime($jobWaitingTime)
  862. {
  863. $this->jobWaitingTime = $jobWaitingTime;
  864. }
  865. /**
  866. * @return string
  867. */
  868. public function getFlightNumber()
  869. {
  870. return $this->flightNumber;
  871. }
  872. /**
  873. * @param string $flightNumber
  874. */
  875. public function setFlightNumber($flightNumber)
  876. {
  877. $this->flightNumber = $flightNumber;
  878. }
  879. /**
  880. * @return string
  881. */
  882. public function getFlightLandingTime()
  883. {
  884. if (! $this->flightLandingTime) {
  885. return ;
  886. }
  887. return $this->flightLandingTime->format('H:i');
  888. }
  889. /**
  890. * @param \DateTime $flightLandingTime
  891. */
  892. public function setFlightLandingTime($flightLandingTime)
  893. {
  894. if (is_string($flightLandingTime)) {
  895. $timeArray = explode(':', $flightLandingTime);
  896. $flightLandingTime = new \DateTime();
  897. $flightLandingTime->setTime(
  898. intval($timeArray[0]),
  899. intval($timeArray[1])
  900. );
  901. }
  902. $this->flightLandingTime = $flightLandingTime;
  903. }
  904. /**
  905. * @return string
  906. */
  907. public function getClientFirstName()
  908. {
  909. return $this->clientFirstName;
  910. }
  911. /**
  912. * @param string $clientFirstName
  913. */
  914. public function setClientFirstName($clientFirstName)
  915. {
  916. $this->clientFirstName = $clientFirstName;
  917. }
  918. /**
  919. * @return string
  920. */
  921. public function getClientLastName()
  922. {
  923. return $this->clientLastName;
  924. }
  925. /**
  926. * @param string $clientLastName
  927. */
  928. public function setClientLastName($clientLastName)
  929. {
  930. $this->clientLastName = $clientLastName;
  931. }
  932. /**
  933. * @return string
  934. */
  935. public function getClientPhone()
  936. {
  937. return $this->clientPhone;
  938. }
  939. /**
  940. * @param string $clientPhone
  941. */
  942. public function setClientPhone($clientPhone)
  943. {
  944. $this->clientPhone = $clientPhone;
  945. }
  946. /**
  947. * @return string
  948. */
  949. public function getClientEmail()
  950. {
  951. return $this->clientEmail;
  952. }
  953. /**
  954. * @param string $clientEmail
  955. */
  956. public function setClientEmail($clientEmail)
  957. {
  958. $this->clientEmail = $clientEmail;
  959. }
  960. public function getVias()
  961. {
  962. return $this->vias;
  963. }
  964. public function setVias($vias)
  965. {
  966. $this->vias = $vias;
  967. }
  968. public function deleteVias($vias)
  969. {
  970. $this->vias->removeElement($vias);
  971. $vias->setBookingRequest(null);
  972. }
  973. public function addVias(BookingViasAddress $bookingViasAddress)
  974. {
  975. $this->vias->add($bookingViasAddress);
  976. }
  977. public function getViasAsArray() {
  978. $vias = [];
  979. /** @var BookingViasAddress $via */
  980. foreach ($this->vias as $via) {
  981. $vias[] = $via->getAddress();
  982. }
  983. return $vias;
  984. }
  985. public function getCountVias()
  986. {
  987. return count($this->vias)>0?count($this->vias):' ';
  988. }
  989. public function getObjectivesAsArray()
  990. {
  991. $objectives = [];
  992. $bookingData = json_decode($this->getBookingDataSerialized());
  993. $selectedObjectivesIds = $bookingData->selectedObjectives;
  994. if (! $selectedObjectivesIds) {
  995. return [];
  996. }
  997. $selectedObjectivesHours = $bookingData->selectedObjectivesHours;
  998. $tours = $bookingData->tours;
  999. $selectedObjectiveArrayById = [];
  1000. foreach ($tours as $tour) {
  1001. foreach ($tour->objectives as $objective) {
  1002. $selectedObjectiveArrayById[$objective->id.'-'.$tour->tourId] = $objective;
  1003. }
  1004. }
  1005. foreach ($selectedObjectivesIds as $selectedObjectiveId) {
  1006. $objectives[] = [
  1007. 'name' => $selectedObjectiveArrayById[$selectedObjectiveId]->title,
  1008. 'price' => $selectedObjectiveArrayById[$selectedObjectiveId]->price,
  1009. 'hour' => $selectedObjectivesHours->$selectedObjectiveId
  1010. ];
  1011. }
  1012. return $objectives;
  1013. }
  1014. public function getReturnObjectivesAsArray()
  1015. {
  1016. $returnObjectives = [];
  1017. $bookingData = json_decode($this->getBookingDataSerialized());
  1018. $selectedObjectivesIds = $bookingData->returnSelectedObjectives;
  1019. if (! $selectedObjectivesIds) {
  1020. return [];
  1021. }
  1022. $selectedObjectivesHours = $bookingData->returnSelectedObjectivesHours;
  1023. $tours = $bookingData->tours;
  1024. $selectedObjectiveArrayById = [];
  1025. foreach ($tours as $tour) {
  1026. foreach ($tour->objectives as $objective) {
  1027. $selectedObjectiveArrayById[$objective->id.'-'.$tour->tourId] = $objective;
  1028. }
  1029. }
  1030. foreach ($selectedObjectivesIds as $selectedObjectiveId) {
  1031. $returnObjectives[] = [
  1032. 'name' => $selectedObjectiveArrayById[$selectedObjectiveId]->title,
  1033. 'price' => $selectedObjectiveArrayById[$selectedObjectiveId]->price,
  1034. 'hour' => $selectedObjectivesHours->$selectedObjectiveId
  1035. ];
  1036. }
  1037. return $returnObjectives;
  1038. }
  1039. public function getPaymentString()
  1040. {
  1041. return Payment::TYPE[$this->getPaymentType()];
  1042. }
  1043. /**
  1044. * @return \DateTime
  1045. */
  1046. public function getPickUpDate()
  1047. {
  1048. return $this->pickUpDate;
  1049. }
  1050. public function setPickUpDate($pickUpDate)
  1051. {
  1052. $this->pickUpDate = $pickUpDate;
  1053. $this->updatePickUpDateTime();
  1054. }
  1055. public function updatePickUpDateTime()
  1056. {
  1057. $pickUpDateTime = $this->pickUpDateTime;
  1058. if (! $pickUpDateTime) {
  1059. $pickUpDateTime = new \DateTime();
  1060. if ($this->pickUpDate) {
  1061. $pickUpDateTime = clone($this->pickUpDate);
  1062. }
  1063. }
  1064. if ($this->pickUpDate) {
  1065. $pickUpDateTime->setDate(
  1066. $this->pickUpDate->format('Y'),
  1067. $this->pickUpDate->format('m'),
  1068. $this->pickUpDate->format('d')
  1069. );
  1070. }
  1071. if ($this->pickUpTime) {
  1072. $pickUpDateTime->setTime(
  1073. intval($this->pickUpTime->format('H')),
  1074. intval($this->pickUpTime->format('i'))
  1075. );
  1076. }
  1077. $this->pickUpDateTime = clone($pickUpDateTime);
  1078. }
  1079. public function getPickUpFullDateTime()
  1080. {
  1081. $date = clone $this->getPickUpDate();
  1082. $pickUpTimeComponents = explode(':', $this->getPickUpTime());
  1083. $date->setTime(
  1084. intval($pickUpTimeComponents[0]),
  1085. intval($pickUpTimeComponents[1])
  1086. );
  1087. return $date;
  1088. }
  1089. public function estimateEndDateTime()
  1090. {
  1091. $interval = $this->getEstimatedTime();
  1092. $intervalComponents = explode(':', $interval);
  1093. $minutes = intval($intervalComponents[0]) * 60 + intval($intervalComponents[1]);
  1094. $pickUp = clone $this->pickUpDateTime;
  1095. $pickUp->add(new \DateInterval('PT' . $minutes . 'M'));
  1096. return $pickUp;
  1097. }
  1098. public function estimateEndHourString()
  1099. {
  1100. return $this->estimateEndDateTime()->format('H:i');
  1101. }
  1102. /**
  1103. * @return CarType|null
  1104. */
  1105. public function getCarType()
  1106. {
  1107. return $this->carType;
  1108. }
  1109. /**
  1110. * @param CarType|null $carType
  1111. */
  1112. public function setCarType($carType)
  1113. {
  1114. $this->carType = $carType;
  1115. }
  1116. /**
  1117. * @return float
  1118. */
  1119. public function getDistanceUnit()
  1120. {
  1121. return $this->distanceUnit;
  1122. }
  1123. /**
  1124. * @param float $distanceUnit
  1125. */
  1126. public function setDistanceUnit($distanceUnit)
  1127. {
  1128. $this->distanceUnit = $distanceUnit;
  1129. }
  1130. /**
  1131. * @return string
  1132. */
  1133. public function getEstimatedTime()
  1134. {
  1135. return $this->estimatedTime;
  1136. }
  1137. /**
  1138. * @param string $estimatedTime
  1139. */
  1140. public function setEstimatedTime($estimatedTime)
  1141. {
  1142. $this->estimatedTime = $estimatedTime;
  1143. }
  1144. /**
  1145. * @param bool $seconds
  1146. * @return string
  1147. */
  1148. public function getEstimatedTimePrettyFormat($seconds = false) {
  1149. $prettyEstimatedTime = '0 minutes';
  1150. if (!empty($this->estimatedTime)) {
  1151. $eT = explode(":", $this->estimatedTime);
  1152. if (count($eT) === 3) {
  1153. $estimatedTime = "";
  1154. if (intval($eT[0]) > 0) {
  1155. $estimatedTime .= intval($eT[0]) . "h ";
  1156. }
  1157. if (intval($eT[1]) > 0) {
  1158. $estimatedTime .= intval($eT[1]) . "min ";
  1159. }
  1160. if (
  1161. ($seconds || empty($estimatedTime)) &&
  1162. intval($eT[2]) > 0
  1163. ) {
  1164. $estimatedTime .= intval($eT[2]) . "s";
  1165. }
  1166. if (!empty($estimatedTime)) {
  1167. $prettyEstimatedTime = $estimatedTime;
  1168. }
  1169. }
  1170. }
  1171. return $prettyEstimatedTime;
  1172. }
  1173. /**
  1174. * @return bool
  1175. */
  1176. public function isCreateAccount()
  1177. {
  1178. return $this->createAccount;
  1179. }
  1180. /**
  1181. * @param bool $createAccount
  1182. */
  1183. public function setCreateAccount($createAccount)
  1184. {
  1185. $this->createAccount = $createAccount;
  1186. }
  1187. /**
  1188. * @return BookingRequest|null
  1189. */
  1190. public function getReturnBooking()
  1191. {
  1192. return $this->returnBooking;
  1193. }
  1194. /**
  1195. * @param BookingRequest|null $returnBooking
  1196. */
  1197. public function setReturnBooking($returnBooking)
  1198. {
  1199. $this->returnBooking = $returnBooking;
  1200. }
  1201. public function __toString()
  1202. {
  1203. return $this->getId() ? (string) $this->getId() : 'n\a';
  1204. }
  1205. /**
  1206. * @return BookingRequest
  1207. */
  1208. public function getParentBooking()
  1209. {
  1210. return $this->parentBooking;
  1211. }
  1212. /**
  1213. * @param BookingRequest $parentBooking
  1214. */
  1215. public function setParentBooking($parentBooking)
  1216. {
  1217. $this->parentBooking = $parentBooking;
  1218. }
  1219. /**
  1220. * @return string
  1221. */
  1222. public function getPickUpPostCode()
  1223. {
  1224. return $this->pickUpPostCode;
  1225. }
  1226. /**
  1227. * @param string $pickUpPostCode
  1228. */
  1229. public function setPickUpPostCode($pickUpPostCode)
  1230. {
  1231. $this->pickUpPostCode = $pickUpPostCode;
  1232. }
  1233. /**
  1234. * @return string
  1235. */
  1236. public function getDestinationPostCode()
  1237. {
  1238. return $this->destinationPostCode;
  1239. }
  1240. /**
  1241. * @param string $destinationPostCode
  1242. */
  1243. public function setDestinationPostCode($destinationPostCode)
  1244. {
  1245. $this->destinationPostCode = $destinationPostCode;
  1246. }
  1247. /**
  1248. * @return string
  1249. */
  1250. public function getClientAlternativePhone()
  1251. {
  1252. return $this->clientAlternativePhone;
  1253. }
  1254. /**
  1255. * @param string $clientAlternativePhone
  1256. */
  1257. public function setClientAlternativePhone($clientAlternativePhone)
  1258. {
  1259. $this->clientAlternativePhone = $clientAlternativePhone;
  1260. }
  1261. /**
  1262. * @return string
  1263. */
  1264. public function getClientAlternativeEmail()
  1265. {
  1266. return $this->clientAlternativeEmail;
  1267. }
  1268. /**
  1269. * @param string $clientAlternativeEmail
  1270. */
  1271. public function setClientAlternativeEmail($clientAlternativeEmail)
  1272. {
  1273. $this->clientAlternativeEmail = $clientAlternativeEmail;
  1274. }
  1275. /**
  1276. * @return string
  1277. */
  1278. public function getVoucherCode()
  1279. {
  1280. return $this->voucherCode;
  1281. }
  1282. /**
  1283. * @param string $voucherCode
  1284. */
  1285. public function setVoucherCode($voucherCode)
  1286. {
  1287. $this->voucherCode = $voucherCode;
  1288. }
  1289. /**
  1290. * @return string
  1291. */
  1292. public function getVoucherValue()
  1293. {
  1294. return $this->voucherValue;
  1295. }
  1296. /**
  1297. * @param string $voucherValue
  1298. */
  1299. public function setVoucherValue($voucherValue)
  1300. {
  1301. $this->voucherValue = $voucherValue;
  1302. }
  1303. public function isCancel()
  1304. {
  1305. $cancelBooking = [
  1306. self::STATUS_DELETED,
  1307. self::STATUS_OFFICE_CANCELLATION,
  1308. self::STATUS_CANCELLED_OTHER_REASON,
  1309. self::STATUS_CLIENT_CANCELLATION
  1310. ];
  1311. if (in_array($this->status, $cancelBooking)) {
  1312. return true;
  1313. }
  1314. return false;
  1315. }
  1316. public function canBroadcast()
  1317. {
  1318. if ($this->getDriver()) {
  1319. return false;
  1320. }
  1321. return ! $this->isExpireBroadcast();
  1322. }
  1323. public function isExpireBroadcast()
  1324. {
  1325. if (! $this->expireBroadcastDate) {
  1326. return false;
  1327. }
  1328. $currentDate = new \DateTime();
  1329. if ($currentDate > $this->expireBroadcastDate) {
  1330. return false;
  1331. }
  1332. return true;
  1333. }
  1334. public function __clone() {
  1335. $this->id = null;
  1336. $this->pickUpDateTime = null;
  1337. $this->pickUpDate = null;
  1338. $this->pickUpTime = null;
  1339. }
  1340. public function formatAddressForListing($address)
  1341. {
  1342. $addressArray = explode(',', $address);
  1343. return [
  1344. array_slice($addressArray, 0, (count($addressArray)-2)),
  1345. array_slice($addressArray, -2)
  1346. ];
  1347. }
  1348. public function getMeetAndGreetTimePrettyFormat() {
  1349. if (!empty($this->getFlightLandingTime())) {
  1350. $pickUpTime = explode(":", $this->getPickUpTime());
  1351. $landingTime = explode(":", $this->getFlightLandingTime());
  1352. $date1 = new \DateTime();
  1353. $date2 = new \DateTime();
  1354. if ($landingTime[0] > $pickUpTime[0]) {
  1355. // the landing time & pick up Time is different day
  1356. // example: landing time 23:50, pick up time: 00:10
  1357. $date1->modify("+1 day");
  1358. }
  1359. $date1->setTime(
  1360. intval($pickUpTime[0]),
  1361. intval($pickUpTime[1])
  1362. );
  1363. $date2->setTime(
  1364. intval($landingTime[0]),
  1365. intval($landingTime[1])
  1366. );
  1367. $difference = date_diff($date1, $date2);
  1368. return ($difference->h ? $difference->h.'H' : '').
  1369. ($difference->i.'M');
  1370. }
  1371. return null;
  1372. }
  1373. /**
  1374. * Set pickUpLat
  1375. *
  1376. * @param float $pickUpLat
  1377. *
  1378. * @return BookingRequest
  1379. */
  1380. public function setPickUpLat($pickUpLat)
  1381. {
  1382. $this->pickUpLat = $pickUpLat;
  1383. return $this;
  1384. }
  1385. /**
  1386. * Get pickUpLat
  1387. *
  1388. * @return float
  1389. */
  1390. public function getPickUpLat()
  1391. {
  1392. return $this->pickUpLat;
  1393. }
  1394. /**
  1395. * Set pickUpLng
  1396. *
  1397. * @param float $pickUpLng
  1398. *
  1399. * @return BookingRequest
  1400. */
  1401. public function setPickUpLng($pickUpLng)
  1402. {
  1403. $this->pickUpLng = $pickUpLng;
  1404. return $this;
  1405. }
  1406. /**
  1407. * Get pickUpLng
  1408. *
  1409. * @return float
  1410. */
  1411. public function getPickUpLng()
  1412. {
  1413. return $this->pickUpLng;
  1414. }
  1415. /**
  1416. * Set destinationLat
  1417. *
  1418. * @param float $destinationLat
  1419. *
  1420. * @return BookingRequest
  1421. */
  1422. public function setDestinationLat($destinationLat)
  1423. {
  1424. $this->destinationLat = $destinationLat;
  1425. return $this;
  1426. }
  1427. /**
  1428. * Get destinationLat
  1429. *
  1430. * @return float
  1431. */
  1432. public function getDestinationLat()
  1433. {
  1434. return $this->destinationLat;
  1435. }
  1436. /**
  1437. * Set destinationLng
  1438. *
  1439. * @param float $destinationLng
  1440. *
  1441. * @return BookingRequest
  1442. */
  1443. public function setDestinationLng($destinationLng)
  1444. {
  1445. $this->destinationLng = $destinationLng;
  1446. return $this;
  1447. }
  1448. /**
  1449. * Get destinationLng
  1450. *
  1451. * @return float
  1452. */
  1453. public function getDestinationLng()
  1454. {
  1455. return $this->destinationLng;
  1456. }
  1457. public function getFullname()
  1458. {
  1459. return sprintf("%s %s", $this->getClientFirstName(), $this->getClientLastName());
  1460. }
  1461. public function getTotalCost()
  1462. {
  1463. return $this->getOverridePrice()?$this->overridePrice:$this->getQuotePrice();
  1464. }
  1465. public function getDriverNameAndInternal()
  1466. {
  1467. if(null!=$this->getDriver() && null!=$this->getDriver()->getUser()) {
  1468. return $this->getDriver()->getUser()->getFirstname() . ' ' . $this->getDriver()->getUser()->getLastname() . ' (' . $this->getDriver()->getInternalName() . ')';
  1469. }else{
  1470. return $this->getDriver();
  1471. }
  1472. }
  1473. public function getBookingDateFormated()
  1474. {
  1475. return $this->getBookingDate()->format('d/m/Y');
  1476. }
  1477. public function getBookingTimeFormated()
  1478. {
  1479. return $this->getBookingDate()->format('H:i');
  1480. }
  1481. public function getPickUpDateFormated()
  1482. {
  1483. return $this->getPickUpDate()->format('d/m/Y');
  1484. }
  1485. public function getTotalCostWithCurrency($currencySymbol = null)
  1486. {
  1487. if($currencySymbol == null){
  1488. $currencySymbol = chr(163);
  1489. }
  1490. return $currencySymbol.' '.$this->getTotalCost();
  1491. }
  1492. public function getStatusAsText()
  1493. {
  1494. return $this->getStringStatus($this->status);
  1495. }
  1496. /**
  1497. * @return string
  1498. */
  1499. public function getNotifiedDrivers()
  1500. {
  1501. return $this->notifiedDrivers;
  1502. }
  1503. /**
  1504. * @param string $notifiedDrivers
  1505. */
  1506. public function setNotifiedDrivers(string $notifiedDrivers): void
  1507. {
  1508. $this->notifiedDrivers = $notifiedDrivers;
  1509. }
  1510. /**
  1511. * @return string
  1512. */
  1513. public function getBookingCreatedKey()
  1514. {
  1515. return $this->bookingCreatedKey;
  1516. }
  1517. /**
  1518. * @param string $bookingCreatedKey
  1519. */
  1520. public function setBookingCreatedKey(string $bookingCreatedKey)
  1521. {
  1522. $this->bookingCreatedKey = $bookingCreatedKey;
  1523. }
  1524. /**
  1525. * @return float
  1526. */
  1527. public function getPmg()
  1528. {
  1529. return $this->pmg;
  1530. }
  1531. /**
  1532. * @param float $pmg
  1533. */
  1534. public function setPmg($pmg)
  1535. {
  1536. $this->pmg = $pmg;
  1537. }
  1538. /**
  1539. * @return float
  1540. */
  1541. public function getReturnPmg()
  1542. {
  1543. return $this->returnPmg;
  1544. }
  1545. /**
  1546. * @param float $returnPmg
  1547. */
  1548. public function setReturnPmg($returnPmg)
  1549. {
  1550. $this->returnPmg = $returnPmg;
  1551. }
  1552. /**
  1553. * @return string
  1554. */
  1555. public function getBookingDataSerialized()
  1556. {
  1557. return $this->bookingDataSerialized;
  1558. }
  1559. /**
  1560. * @param string $bookingDataSerialized
  1561. */
  1562. public function setBookingDataSerialized($bookingDataSerialized)
  1563. {
  1564. $this->bookingDataSerialized = $bookingDataSerialized;
  1565. }
  1566. public function getBookingDataSerializedDecoded()
  1567. {
  1568. return json_decode($this->bookingDataSerialized);
  1569. }
  1570. }