src/AdminBundle/Entity/Driver.php line 1890

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Entity;
  3. use DateTime;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Criteria;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Eventviva\ImageResize;
  8. use Symfony\Component\HttpFoundation\File\UploadedFile;
  9. /**
  10. * Driver
  11. */
  12. #[ORM\Table(name: 'driver')]
  13. #[ORM\Index(name: 'status_lat_lng_last_update_index', columns: ['status', 'lat', 'lng', 'last_update_pozition'])]
  14. #[ORM\Entity(repositoryClass: \AdminBundle\Repository\DriverRepository::class)]
  15. #[ORM\HasLifecycleCallbacks]
  16. class Driver extends BaseEntity
  17. {
  18. const STATUS_ACTIVE = 1;
  19. const STATUS_SUSPENDED = 2;
  20. const STATUS_NOT_CONFIRMED = 3;
  21. const STATUS_EMERGENCY = 4;
  22. const STATUS_ON_HOLIDAY = 5;
  23. const SIMPLE_STATUS_AVAILABLE = 1;
  24. const SIMPLE_STATUS_BUSY = 2;
  25. const SIMPLE_STATUS_END_OF_SHIFT = 3;
  26. const OFF_DAY_MONDAY = 'Monday';
  27. const OFF_DAY_TUESDAY = 'Tuesday';
  28. const OFF_DAY_WEDNESDAY = 'Wednesday';
  29. const OFF_DAY_THURSDAY = 'Thursday';
  30. const OFF_DAY_FRIDAY = 'Friday';
  31. const OFF_DAY_SATURDAY = 'Saturday';
  32. const OFF_DAY_SUNDAY = 'Sunday';
  33. // Positive reputation points
  34. const REPUTATION_POINTS_NONE = 0;
  35. const REPUTATION_POINTS_LOGGED_IN = 1;
  36. const REPUTATION_POINTS_AUTOASSIGN_BOOKING = 3;
  37. const REPUTATION_POINTS_DRIVER_LOGGED_UNDER_5_HOURS = 4;
  38. const REPUTATION_POINTS_DISPATCH_ACCEPT = 5;
  39. const REPUTATION_POINTS_DRIVER_LOGGED_OVER_5_HOURS = 6;
  40. const REPUTATION_POINTS_DISPATCH_ACCEPT_OVER_12_HOURS = 3;
  41. const REPUTATION_POINTS_DISPATCH_ACCEPT_UNDER_12_HOURS = 4;
  42. const REPUTATION_POINTS_POSITIVE_REVIEW = 5;
  43. const REPUTATION_POINTS_ASAP_CONFIRMED = 6;
  44. const REPUTATION_POINTS_DISPATCH_ACCEPT_WHILE_IN_QUEUE = 6;
  45. const REPUTATION_POINTS_DISPATCHED_NEARBY_WHILE_IN_QUEUE = 6;
  46. const REPUTATION_POINTS_BOOKING_MANUALLY_DISPATCH = 10;
  47. const REPUTATION_POINTS_BOOKING_COMPLETED_THREE = 10;
  48. const REPUTATION_POINTS_BOOKING_ACCEPTED_IN_WEEKEND = 10;
  49. const REPUTATION_POINTS_BOOKING_COMPLETED = 20;
  50. const REPUTATION_POINTS_BOOKING_PACKAGE_REQUEST_CONFIRMED_12_HOURS = 10;
  51. const REPUTATION_POINTS_BOOKING_PACKAGE_REQUEST_CONFIRMED_24_HOURS = 6;
  52. const REPUTATION_POINTS_LINKED_BOOKING_REQUEST_CONFIRMED = 9;
  53. const REPUTATION_POINTS_BOOKING_REQUEST_CONFIRMED_24_HOURS = 3;
  54. // Negative reputation points
  55. const REPUTATION_POINTS_NEGATIVE_REVIEW = -2;
  56. const REPUTATION_POINTS_LAST_LOGIN_UNDER_3_DAYS = -3;
  57. const REPUTATION_POINTS_ASAP_REJECTED = -7;
  58. const REPUTATION_POINTS_BOOKING_REJECTED_WHILE_IN_QUEUE = -8;
  59. const REPUTATION_POINTS_LAST_LOGIN_OVER_3_DAYS = -9;
  60. const REPUTATION_POINTS_BOOKING_REJECTED = -10;
  61. const REPUTATION_POINTS_BOOKING_DEALLOCATED_ON_DEMAND = -10;
  62. const REPUTATION_POINTS_NO_BOOKING_ACCEPTED_IN_WEEKEND = -10;
  63. const REPUTATION_POINTS_AUTOSUSPENDED = -20;
  64. const REPUTATION_POINTS_LINKED_BOOKING_REQUEST_DEALLOCATED_ON_DEMAND = -9;
  65. const REPUTATION_POINTS_BOOKING_REQUEST_DEALLOCATED_ON_DEMAND_12_HOURS = -10;
  66. const REPUTATION_POINTS_BOOKING_REQUEST_DEALLOCATED_ON_DEMAND_24_HOURS = -4;
  67. const REPUTATION_POINTS_BOOKING_PACKAGE_REQUEST_DEALLOCATED_ON_DEMAND_12_HOURS = -10;
  68. const REPUTATION_POINTS_BOOKING_PACKAGE_REQUEST_DEALLOCATED_ON_DEMAND_24_HOURS = -8;
  69. const ACTIVITY_REPUTATION_PERCENTAGE = 70;
  70. const INTERNAL_REPUTATION_PERCENTAGE = 30;
  71. public static $statusTypes = [
  72. self::STATUS_ACTIVE => 'Active',
  73. self::STATUS_SUSPENDED => 'Suspended',
  74. self::STATUS_NOT_CONFIRMED => 'Not confirmed',
  75. self::STATUS_ON_HOLIDAY => 'On Holiday',
  76. ];
  77. public static $simpleStatusTypes = [
  78. self::SIMPLE_STATUS_AVAILABLE => 'Available',
  79. self::SIMPLE_STATUS_BUSY => 'On a Break',
  80. self::STATUS_EMERGENCY => 'Emergency / Flag Down',
  81. self::SIMPLE_STATUS_END_OF_SHIFT => 'End of Shift / Logout',
  82. ];
  83. public static $offDaysTypes = [
  84. self::OFF_DAY_MONDAY => 'Monday',
  85. self::OFF_DAY_TUESDAY => 'Tuesday',
  86. self::OFF_DAY_WEDNESDAY => 'Wednesday',
  87. self::OFF_DAY_THURSDAY => 'Thursday',
  88. self::OFF_DAY_FRIDAY => 'Friday',
  89. self::OFF_DAY_SATURDAY => 'Saturday',
  90. self::OFF_DAY_SUNDAY => 'Sunday',
  91. ];
  92. const DRIVER_FILE_FOLDER = 'upload/driver/';
  93. const PROFILE_PICTURE_SETTER = 'setPicture';
  94. const PROOF_OF_RIGHT_TO_WORK_SETTER = 'setProofOfRightToWork';
  95. const HACK_LICENSE_FILE_SETTER = 'setHackLicenseFile';
  96. const DRIVER_LICENSE_PICTURE_SETTER = 'setDriverLicencePicture';
  97. const PCO_LICENSE_FILE_SETTER = 'setPcoLicenseFile';
  98. const NINO_FILE_SETTER = 'setNinoFile';
  99. const DBS_CRIMINAL_CHECK_FILE_SETTER = 'setDbsCriminalCheckFile';
  100. const DRIVER_AGREEMENT_FILE_SETTER = 'setDriverAgreementFile';
  101. const OTHER_DOCUMENT_SETTER = 'setOtherDocument';
  102. const REFERRAL_CODE_PREFIX = 'TW20';
  103. /**
  104. * @var integer
  105. */
  106. #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
  107. #[ORM\Id]
  108. #[ORM\GeneratedValue(strategy: 'IDENTITY')]
  109. protected $id;
  110. /**
  111. * @var string
  112. */
  113. #[ORM\Column(name: 'internal_name', type: 'string', length: 64)]
  114. protected $internalName;
  115. /**
  116. * @var string
  117. */
  118. #[ORM\Column(name: 'license', type: 'string', length: 64)]
  119. protected $license;
  120. /**
  121. * @var \DateTime
  122. */
  123. #[ORM\Column(name: 'license_expire_date', type: 'date')]
  124. protected $licenseExpireDate;
  125. /**
  126. * @var \DateTime
  127. */
  128. #[ORM\Column(name: 'license_issue_date', type: 'date')]
  129. protected $licenseIssueDate;
  130. /**
  131. * @var \DateTime
  132. */
  133. #[ORM\Column(name: 'public_carriage_office_expiry_date', type: 'date', nullable: true)]
  134. protected $publicCarriageOfficeExpiryDate;
  135. /**
  136. * @var string
  137. */
  138. #[ORM\Column(name: 'public_carriage_office_licence_number', type: 'string', length: 255, nullable: true)]
  139. protected $publicCarriageOfficeLicenceNumber;
  140. /**
  141. * @var \DateTime
  142. */
  143. #[ORM\Column(name: 'hack_license_expiration_date', type: 'date', nullable: true)]
  144. protected $hackLicenseExpirationDate;
  145. /**
  146. * @var string
  147. */
  148. #[ORM\Column(name: 'hack_license_number', type: 'string', length: 255, nullable: true)]
  149. protected $hackLicenseNumber;
  150. /**
  151. * @var \DateTime
  152. */
  153. #[ORM\Column(name: 'registration_date', type: 'date')]
  154. protected $registrationDate;
  155. /**
  156. * @var \DateTime
  157. */
  158. #[ORM\Column(name: 'end_date', type: 'date', nullable: true)]
  159. protected $endDate;
  160. /**
  161. * @var \DateTime
  162. */
  163. #[ORM\Column(name: 'updated', type: 'datetime')]
  164. protected $updated;
  165. /**
  166. * @var string
  167. */
  168. #[ORM\Column(name: 'phone', type: 'string', length: 20)]
  169. protected $phone;
  170. /**
  171. * @var string
  172. */
  173. #[ORM\Column(name: 'mobile_phone', type: 'string', length: 20, nullable: true)]
  174. protected $mobilePhone;
  175. /**
  176. * @var integer
  177. */
  178. #[ORM\Column(name: 'status', type: 'integer')]
  179. protected $status;
  180. /**
  181. * @var integer
  182. */
  183. #[ORM\Column(name: 'start_interval', type: 'integer', nullable: true)]
  184. protected $startInterval;
  185. /**
  186. * @var boolean
  187. */
  188. #[ORM\Column(name: 'selected_start_interval', type: 'boolean')]
  189. protected $selectedStartInterval = false;
  190. /**
  191. * @var integer
  192. */
  193. #[ORM\Column(name: 'simple_status', type: 'integer')]
  194. protected $simpleStatus;
  195. /**
  196. * @var string
  197. */
  198. #[ORM\Column(name: 'house_street_number', type: 'string', length: 255, nullable: true)]
  199. protected $houseStreetNumber;
  200. /**
  201. * @var string
  202. */
  203. #[ORM\Column(name: 'home_address_1', type: 'string', length: 255, nullable: true)]
  204. protected $homeAddress1;
  205. /**
  206. * @var string
  207. */
  208. #[ORM\Column(name: 'home_address_2', type: 'string', length: 255, nullable: true)]
  209. protected $homeAddress2;
  210. /**
  211. * @var string
  212. */
  213. #[ORM\Column(name: 'home_address_city', type: 'string', length: 255, nullable: true)]
  214. protected $homeAddressCity;
  215. /**
  216. * @var string
  217. */
  218. #[ORM\Column(name: 'home_address_postcode', type: 'string', length: 255, nullable: true)]
  219. protected $homeAddressPostcode;
  220. /**
  221. * @var float
  222. */
  223. #[ORM\Column(name: 'home_address_lat', type: 'float', precision: 10, scale: 6, nullable: true)]
  224. protected $homeAddressLat;
  225. /**
  226. * @var float
  227. */
  228. #[ORM\Column(name: 'home_address_lng', type: 'float', precision: 10, scale: 6, nullable: true)]
  229. protected $homeAddressLng;
  230. /**
  231. * @var string
  232. */
  233. #[ORM\Column(name: 'home_address_country', type: 'string', length: 255, nullable: true)]
  234. protected $homeAddressCountry;
  235. /**
  236. * @var string
  237. */
  238. #[ORM\Column(name: 'description', type: 'text', nullable: true)]
  239. protected $description;
  240. /**
  241. * @var string
  242. */
  243. #[ORM\Column(name: 'last_update_pozition', type: 'datetime', nullable: true)]
  244. private $lastUpdatePozition;
  245. /**
  246. * @var string
  247. */
  248. #[ORM\Column(name: 'lat', type: 'float', precision: 10, scale: 6, nullable: true)]
  249. private $lat;
  250. /**
  251. * @var string
  252. */
  253. #[ORM\Column(name: 'lng', type: 'float', precision: 10, scale: 6, nullable: true)]
  254. private $lng;
  255. /**
  256. * @var string
  257. */
  258. #[ORM\Column(name: 'picture', type: 'string', length: 255, nullable: true)]
  259. protected $picture;
  260. /**
  261. * @var string
  262. */
  263. #[ORM\Column(name: 'pco_license_file', type: 'string', length: 255, nullable: true)]
  264. protected $pcoLicenseFile;
  265. /**
  266. * @var string
  267. */
  268. #[ORM\Column(name: 'hack_license_file', type: 'string', length: 255, nullable: true)]
  269. protected $hackLicenseFile;
  270. /**
  271. * @var string
  272. */
  273. #[ORM\Column(name: 'proof_of_right_to_work', type: 'string', length: 255, nullable: true)]
  274. protected $proofOfRightToWork;
  275. /**
  276. * @var string
  277. */
  278. #[ORM\Column(name: 'nino_file', type: 'string', length: 255, nullable: true)]
  279. protected $ninoFile;
  280. /**
  281. * @var string
  282. */
  283. #[ORM\Column(name: 'dbs_criminal_check_file', type: 'string', length: 255, nullable: true)]
  284. protected $dbsCriminalCheckFile;
  285. /**
  286. * @var string
  287. */
  288. #[ORM\Column(name: 'driver_agreement_file', type: 'string', length: 255, nullable: true)]
  289. protected $driverAgreementFile;
  290. /**
  291. * @var string
  292. */
  293. #[ORM\Column(name: 'other_document', type: 'string', length: 255, nullable: true)]
  294. protected $otherDocument;
  295. /**
  296. * @var string
  297. */
  298. #[ORM\Column(name: 'driver_licence_picture', type: 'string', length: 255, nullable: true)]
  299. protected $driverLicencePicture;
  300. /**
  301. * @var string
  302. */
  303. #[ORM\Column(name: 'nationality', type: 'string', length: 255, nullable: true)]
  304. protected $nationality;
  305. /**
  306. * @var string
  307. */
  308. #[ORM\Column(name: 'national_insurance_number', type: 'string', length: 255, nullable: true)]
  309. protected $nationalInsuranceNumber;
  310. /**
  311. * @var string
  312. */
  313. #[ORM\Column(name: 'social_security_number', type: 'string', length: 255, nullable: true)]
  314. protected $socialSecurityNumber;
  315. /**
  316. * @var string
  317. */
  318. #[ORM\Column(name: 'bank_society', type: 'string', length: 255, nullable: true)]
  319. protected $bankSociety;
  320. /**
  321. * @var string
  322. */
  323. #[ORM\Column(name: 'bank_sort_code', type: 'string', length: 255, nullable: true)]
  324. protected $bankSortCode;
  325. /**
  326. * @var boolean
  327. */
  328. #[ORM\Column(name: 'all_day_shift', type: 'boolean', nullable: true)]
  329. protected $allDayShift = false;
  330. /**
  331. * @var \DateTime
  332. */
  333. #[ORM\Column(name: 'day_time_shift_start', type: 'time', nullable: true)]
  334. protected $dayTimeShiftStart;
  335. /**
  336. * @var \DateTime
  337. */
  338. #[ORM\Column(name: 'day_time_shift_end', type: 'time', nullable: true)]
  339. protected $dayTimeShiftEnd;
  340. /**
  341. * @var \DateTime
  342. */
  343. #[ORM\Column(name: 'night_time_shift_start', type: 'time', nullable: true)]
  344. protected $nightTimeShiftStart;
  345. /**
  346. * @var \DateTime
  347. */
  348. #[ORM\Column(name: 'night_time_shift_end', type: 'time', nullable: true)]
  349. protected $nightTimeShiftEnd;
  350. /**
  351. * @var string
  352. */
  353. #[ORM\Column(name: 'departure_location', type: 'string', length: 255, nullable: true)]
  354. protected $departureLocation;
  355. /**
  356. * @var float
  357. */
  358. #[ORM\Column(name: 'departure_location_lat', type: 'float', precision: 10, scale: 6, nullable: true)]
  359. protected $departureLocationLat;
  360. /**
  361. * @var float
  362. */
  363. #[ORM\Column(name: 'departure_location_lng', type: 'float', precision: 10, scale: 6, nullable: true)]
  364. protected $departureLocationLng;
  365. /**
  366. * @var string
  367. */
  368. #[ORM\Column(name: 'favorite_airport', type: 'string', length: 255, nullable: true)]
  369. protected $favoriteAirport;
  370. /**
  371. * @var float
  372. */
  373. #[ORM\Column(name: 'favorite_airport_lat', type: 'float', precision: 10, scale: 6, nullable: true)]
  374. protected $favoriteAirportLat;
  375. /**
  376. * @var float
  377. */
  378. #[ORM\Column(name: 'favorite_airport_lng', type: 'float', precision: 10, scale: 6, nullable: true)]
  379. protected $favoriteAirportLng;
  380. /**
  381. * @var string
  382. */
  383. #[ORM\Column(name: 'bank_account_number', type: 'string', length: 255, nullable: true)]
  384. protected $bankAccountNumber;
  385. #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
  386. #[ORM\OneToOne(targetEntity: \User::class, inversedBy: 'driver', cascade: ['all'])]
  387. protected $user;
  388. #[ORM\JoinColumn(name: 'car_id', referencedColumnName: 'id', unique: true, nullable: true)]
  389. #[ORM\ManyToOne(targetEntity: \Car::class, inversedBy: 'drivers')]
  390. protected $car;
  391. #[ORM\OneToMany(targetEntity: \Booking::class, mappedBy: 'driver')]
  392. private $bookings;
  393. #[ORM\OneToMany(targetEntity: \BookingRequest::class, mappedBy: 'driver')]
  394. private $bookings_request;
  395. /**
  396. * @var ArrayCollection
  397. */
  398. #[ORM\OneToMany(targetEntity: \BroadcastedDriver::class, mappedBy: 'driver', cascade: ['persist', 'remove'], orphanRemoval: true)]
  399. private $broadcastedDrivers;
  400. /**
  401. * @var ArrayCollection
  402. */
  403. #[ORM\OneToMany(targetEntity: \UnassignedBookingsDriverRequests::class, mappedBy: 'driver', cascade: ['persist', 'remove'], orphanRemoval: true)]
  404. private $unassignedBookingsRequests;
  405. /**
  406. * @var ArrayCollection
  407. */
  408. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\NotificationBookingUpdate::class, mappedBy: 'driver', cascade: ['persist', 'remove'], orphanRemoval: true)]
  409. private $notificationBookingUpdates;
  410. /**
  411. * @var ArrayCollection
  412. */
  413. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverHistoryCars::class, mappedBy: 'driver', cascade: ['persist'])]
  414. private $historyCars;
  415. /**
  416. * @var Driver
  417. */
  418. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverInvoices::class, mappedBy: 'driver', cascade: ['persist'])]
  419. private $invoices;
  420. /**
  421. * @var double
  422. */
  423. #[ORM\Column(name: 'commission_office_up_to500', type: 'decimal', scale: 2, nullable: true)]
  424. protected $commissionOfficeUpTo500 = 0;
  425. /**
  426. * @var double
  427. */
  428. #[ORM\Column(name: 'commission_office_up_to1000', type: 'decimal', scale: 2, nullable: true)]
  429. protected $commissionOfficeUpTo1000 = 0;
  430. /**
  431. * @var double
  432. */
  433. #[ORM\Column(name: 'commission_office_up_to1500', type: 'decimal', scale: 2, nullable: true)]
  434. protected $commissionOfficeUpTo1500 = 0;
  435. /**
  436. * @var double
  437. */
  438. #[ORM\Column(name: 'commission_office_over1500', type: 'decimal', scale: 2, nullable: true)]
  439. protected $commissionOfficeOver1500 = 0;
  440. /**
  441. * @var array
  442. */
  443. #[ORM\Column(name: 'off_days', type: 'array', nullable: true)]
  444. protected $offDays;
  445. /**
  446. * @var ArrayCollection
  447. */
  448. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverHistory::class, mappedBy: 'driver', cascade: ['persist'])]
  449. protected $driverHistory;
  450. /**
  451. * @var \DateTime
  452. */
  453. #[ORM\Column(name: 'suspended_until_date', type: 'datetime', nullable: true)]
  454. protected $suspendedUntilDate;
  455. /**
  456. * @var double
  457. */
  458. #[ORM\Column(name: 'internal_reputation', type: 'decimal', scale: 2, nullable: false, options: ['default' => '5.0'])]
  459. protected $internalReputation = 0;
  460. /**
  461. * @var double
  462. */
  463. #[ORM\Column(name: 'activity_reputation', type: 'decimal', scale: 2, nullable: false)]
  464. protected $activityReputation = 0;
  465. /**
  466. * @var integer
  467. */
  468. #[ORM\Column(name: 'reputation_points', type: 'integer', nullable: false, options: ['default' => 10000])]
  469. protected $reputationPoints = 10000;
  470. /**
  471. * @var integer
  472. */
  473. #[ORM\Column(name: 'top_reputation_points', type: 'integer', nullable: false, options: ['default' => 10000])]
  474. protected $topReputationPoints = 10000;
  475. /**
  476. * @var integer
  477. */
  478. #[ORM\Column(name: 'new_linked_booking_count', type: 'integer', nullable: false, options: ['default' => 0])]
  479. protected $newLinkedBookingCount = 0;
  480. /**
  481. * @var \DateTime
  482. */
  483. #[ORM\Column(name: 'deactivated_until', type: 'datetime', nullable: true)]
  484. protected $deactivatedUntil;
  485. /**
  486. * @var ArrayCollection
  487. */
  488. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverTimeShifts::class, mappedBy: 'driver', cascade: ['remove'])]
  489. protected $driverTimeShifts;
  490. /**
  491. * @var ArrayCollection
  492. */
  493. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverHistoryQueue::class, mappedBy: 'driver', cascade: ['remove'])]
  494. protected $driverHistoryQueues;
  495. /**
  496. * @var ArrayCollection
  497. */
  498. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverHistoryTimelogs::class, mappedBy: 'driver', cascade: ['remove'])]
  499. protected $driverHistoryTimelogs;
  500. #[ORM\OneToMany(targetEntity: \AdminBundle\Entity\Answer::class, mappedBy: 'driver', cascade: ['all'], orphanRemoval: true)]
  501. private $answers;
  502. private $pictureFile;
  503. private $driverLicencePictureFile;
  504. private $pcoLicenseFileFile;
  505. private $proofOfRightToWorkFile;
  506. private $hackLicenseFileFile;
  507. private $ninoFileFile;
  508. private $dbsCriminalCheckFileFile;
  509. private $driverAgreementFileFile;
  510. private $otherDocumentFile;
  511. public function __construct()
  512. {
  513. $this->user = new User();
  514. $this->updated = new \DateTime();
  515. $this->bookings = new ArrayCollection();
  516. $this->bookings_request = new ArrayCollection();
  517. $this->broadcastedDrivers = new ArrayCollection();
  518. $this->notificationBookingUpdates = new ArrayCollection();
  519. $this->driverHistory = new ArrayCollection();
  520. $this->driverTimeShifts = new ArrayCollection();
  521. $this->driverHistoryQueues = new ArrayCollection();
  522. $this->driverHistoryTimelogs = new ArrayCollection();
  523. $this->answers = new ArrayCollection();
  524. $this->dayTimeShiftStart = new \DateTime();
  525. $this->dayTimeShiftStart->setTime(3, 0, 0);
  526. $this->dayTimeShiftEnd = new \DateTime();
  527. $this->dayTimeShiftEnd->setTime(20, 0, 0);
  528. $this->nightTimeShiftStart = new \DateTime();
  529. $this->nightTimeShiftStart->setTime(20, 0, 0);
  530. $this->nightTimeShiftEnd = new \DateTime();
  531. $this->nightTimeShiftEnd->setTime(3, 0, 0);
  532. }
  533. /**
  534. * @return int
  535. */
  536. public function getId()
  537. {
  538. return $this->id;
  539. }
  540. /**
  541. * @param int $id
  542. */
  543. public function setId($id)
  544. {
  545. $this->id = $id;
  546. }
  547. /*
  548. * ???
  549. */
  550. public function getLastUpdatePozitionString()
  551. {
  552. if (!$this->lastUpdatePozition) {
  553. return;
  554. }
  555. return $this->lastUpdatePozition->format('Y-m-d H:i:s');
  556. }
  557. /**
  558. * @return \DateTime
  559. */
  560. public function getLastUpdatePozition()
  561. {
  562. return $this->lastUpdatePozition;
  563. }
  564. /**
  565. * @param \DateTime $lastUpdatePozition
  566. * @return Driver
  567. */
  568. public function setLastUpdatePozition($lastUpdatePozition): Driver
  569. {
  570. $this->lastUpdatePozition = $lastUpdatePozition;
  571. return $this;
  572. }
  573. /**
  574. * @return float
  575. */
  576. public function getLat()
  577. {
  578. return $this->lat;
  579. }
  580. /**
  581. * @param float $lat
  582. * @return Driver
  583. */
  584. public function setLat($lat): Driver
  585. {
  586. $this->lat = $lat;
  587. return $this;
  588. }
  589. /**
  590. * @return float
  591. */
  592. public function getLng()
  593. {
  594. return $this->lng;
  595. }
  596. /**
  597. * @param float $lng
  598. * @return Driver
  599. */
  600. public function setLng($lng): Driver
  601. {
  602. $this->lng = $lng;
  603. return $this;
  604. }
  605. /**
  606. * @return string
  607. */
  608. public function getInternalName()
  609. {
  610. return $this->internalName;
  611. }
  612. /**
  613. * @param string $internalName
  614. */
  615. public function setInternalName($internalName)
  616. {
  617. $this->internalName = $internalName;
  618. }
  619. /**
  620. * @return int
  621. */
  622. public function getStartInterval()
  623. {
  624. return $this->startInterval;
  625. }
  626. public function setStartInterval($startInterval)
  627. {
  628. $this->startInterval = $startInterval;
  629. }
  630. /**
  631. * @return string
  632. */
  633. public function getLicense()
  634. {
  635. return $this->license;
  636. }
  637. /**
  638. * @param string $license
  639. */
  640. public function setLicense($license)
  641. {
  642. $this->license = $license;
  643. }
  644. /**
  645. * @return \DateTime
  646. */
  647. public function getLicenseExpireDate()
  648. {
  649. return $this->licenseExpireDate;
  650. }
  651. /**
  652. * @param \DateTime $licenseExpireDate
  653. */
  654. public function setLicenseExpireDate($licenseExpireDate)
  655. {
  656. $this->licenseExpireDate = $licenseExpireDate;
  657. }
  658. /**
  659. * @return \DateTime
  660. */
  661. public function getLicenseIssueDate()
  662. {
  663. return $this->licenseIssueDate;
  664. }
  665. /**
  666. * @param \DateTime $licenseIssueDate
  667. */
  668. public function setLicenseIssueDate($licenseIssueDate)
  669. {
  670. $this->licenseIssueDate = $licenseIssueDate;
  671. }
  672. /**
  673. * @return bool
  674. */
  675. public function isSelectedStartInterval()
  676. {
  677. return $this->selectedStartInterval;
  678. }
  679. /**
  680. * @param bool $selectedStartInterval
  681. */
  682. public function setSelectedStartInterval($selectedStartInterval)
  683. {
  684. $this->selectedStartInterval = $selectedStartInterval;
  685. }
  686. /**
  687. * @return \DateTime
  688. */
  689. public function getPublicCarriageOfficeExpiryDate()
  690. {
  691. return $this->publicCarriageOfficeExpiryDate;
  692. }
  693. /**
  694. * @param \DateTime $publicCarriageOfficeExpiryDate
  695. */
  696. public function setPublicCarriageOfficeExpiryDate($publicCarriageOfficeExpiryDate)
  697. {
  698. $this->publicCarriageOfficeExpiryDate = $publicCarriageOfficeExpiryDate;
  699. }
  700. /**
  701. * @return string
  702. */
  703. public function getPublicCarriageOfficeLicenceNumber()
  704. {
  705. return $this->publicCarriageOfficeLicenceNumber;
  706. }
  707. /**
  708. * @param string $publicCarriageOfficeLicenceNumber
  709. */
  710. public function setPublicCarriageOfficeLicenceNumber($publicCarriageOfficeLicenceNumber)
  711. {
  712. $this->publicCarriageOfficeLicenceNumber = $publicCarriageOfficeLicenceNumber;
  713. }
  714. /**
  715. * @return string
  716. */
  717. public function getDepartureLocation()
  718. {
  719. return $this->departureLocation;
  720. }
  721. /**
  722. * @param string $departureLocation
  723. */
  724. public function setDepartureLocation($departureLocation)
  725. {
  726. $this->departureLocation = $departureLocation;
  727. }
  728. /**
  729. * @return string
  730. */
  731. public function getFavoriteAirport()
  732. {
  733. return $this->favoriteAirport;
  734. }
  735. /**
  736. * @param string $favoriteAirport
  737. */
  738. public function setFavoriteAirport($favoriteAirport)
  739. {
  740. $this->favoriteAirport = $favoriteAirport;
  741. }
  742. /**
  743. * @return \DateTime
  744. */
  745. public function getRegistrationDate()
  746. {
  747. return $this->registrationDate;
  748. }
  749. /**
  750. * @param \DateTime $registrationDate
  751. */
  752. public function setRegistrationDate($registrationDate)
  753. {
  754. $this->registrationDate = $registrationDate;
  755. }
  756. /**
  757. * @return string
  758. */
  759. public function getPhone()
  760. {
  761. return $this->phone;
  762. }
  763. /**
  764. * @param string $phone
  765. */
  766. public function setPhone($phone)
  767. {
  768. $this->phone = $phone;
  769. }
  770. /**
  771. * @return string
  772. */
  773. public function getMobilePhone()
  774. {
  775. return $this->mobilePhone;
  776. }
  777. /**
  778. * @param string $mobilePhone
  779. * @return Driver
  780. */
  781. public function setMobilePhone($mobilePhone): Driver
  782. {
  783. $this->mobilePhone = $mobilePhone;
  784. return $this;
  785. }
  786. /**
  787. * @return mixed
  788. */
  789. public function getStatus()
  790. {
  791. return $this->status;
  792. }
  793. /**
  794. * @param mixed $status
  795. */
  796. public function setStatus($status)
  797. {
  798. $this->status = $status;
  799. }
  800. /**
  801. * @return mixed
  802. */
  803. public function getSimpleStatus()
  804. {
  805. return $this->simpleStatus;
  806. }
  807. /**
  808. * @param mixed $simpleStatus
  809. * @return $this
  810. */
  811. public function setSimpleStatus($simpleStatus)
  812. {
  813. $this->simpleStatus = $simpleStatus;
  814. return $this;
  815. }
  816. /**
  817. * @return string
  818. */
  819. public function getHomeAddress1()
  820. {
  821. return $this->homeAddress1;
  822. }
  823. /**
  824. * @param string $homeAddress1
  825. */
  826. public function setHomeAddress1($homeAddress1)
  827. {
  828. $this->homeAddress1 = $homeAddress1;
  829. }
  830. /**
  831. * @return string
  832. */
  833. public function getHomeAddress2()
  834. {
  835. return $this->homeAddress2;
  836. }
  837. /**
  838. * @param string $homeAddress2
  839. */
  840. public function setHomeAddress2($homeAddress2)
  841. {
  842. $this->homeAddress2 = $homeAddress2;
  843. }
  844. /**
  845. * @return string
  846. */
  847. public function getHomeAddressCity()
  848. {
  849. return $this->homeAddressCity;
  850. }
  851. /**
  852. * @param string $homeAddressCity
  853. */
  854. public function setHomeAddressCity($homeAddressCity)
  855. {
  856. $this->homeAddressCity = $homeAddressCity;
  857. }
  858. /**
  859. * @return string
  860. */
  861. public function getHomeAddressPostcode()
  862. {
  863. return $this->homeAddressPostcode;
  864. }
  865. /**
  866. * @param string $homeAddressPostcode
  867. */
  868. public function setHomeAddressPostcode($homeAddressPostcode)
  869. {
  870. $this->homeAddressPostcode = $homeAddressPostcode;
  871. }
  872. /**
  873. * @return string
  874. */
  875. public function getHomeAddressCountry()
  876. {
  877. return $this->homeAddressCountry;
  878. }
  879. /**
  880. * @param string $homeAddressCountry
  881. */
  882. public function setHomeAddressCountry($homeAddressCountry)
  883. {
  884. $this->homeAddressCountry = $homeAddressCountry;
  885. }
  886. /**
  887. * @return string
  888. */
  889. public function getDescription()
  890. {
  891. return $this->description;
  892. }
  893. /**
  894. * @param string $description
  895. */
  896. public function setDescription($description)
  897. {
  898. $this->description = $description;
  899. }
  900. /**
  901. * @param UploadedFile $picture
  902. */
  903. public function setPictureFile(UploadedFile $pictureFile = null)
  904. {
  905. $this->pictureFile = $pictureFile;
  906. }
  907. /**
  908. * @param UploadedFile $picture
  909. */
  910. public function setDriverLicencePictureFile(UploadedFile $driverLicencePictureFile = null)
  911. {
  912. $this->driverLicencePictureFile = $driverLicencePictureFile;
  913. }
  914. /**
  915. * @param UploadedFile $file
  916. */
  917. public function setPcoLicenseFileFile(UploadedFile $driverPcoLicenseFileFile = null)
  918. {
  919. $this->pcoLicenseFileFile = $driverPcoLicenseFileFile;
  920. }
  921. /**
  922. * @param UploadedFile $file
  923. */
  924. public function setProofOfRightToWorkFile(UploadedFile $proofOfRightToWorkFile = null)
  925. {
  926. $this->proofOfRightToWorkFile = $proofOfRightToWorkFile;
  927. }
  928. /**
  929. * @param UploadedFile $hackLicenseFileFile
  930. */
  931. public function setHackLicenseFileFile(UploadedFile $hackLicenseFileFile = null)
  932. {
  933. $this->hackLicenseFileFile = $hackLicenseFileFile;
  934. }
  935. /**
  936. * @param UploadedFile $file
  937. */
  938. public function setNinoFileFile(UploadedFile $ninoFileFile = null)
  939. {
  940. $this->ninoFileFile = $ninoFileFile;
  941. }
  942. /**
  943. * @param UploadedFile $file
  944. */
  945. public function setDbsCriminalCheckFileFile(UploadedFile $dbsCriminalCheckFileFile = null)
  946. {
  947. $this->dbsCriminalCheckFileFile = $dbsCriminalCheckFileFile;
  948. }
  949. /**
  950. * @param UploadedFile $file
  951. */
  952. public function setDriverAgreementFileFile(UploadedFile $driverAgreementFileFile = null)
  953. {
  954. $this->driverAgreementFileFile = $driverAgreementFileFile;
  955. }
  956. /**
  957. * @param UploadedFile $file
  958. */
  959. public function setOtherDocumentFile(UploadedFile $otherDocumentFile = null)
  960. {
  961. $this->otherDocumentFile = $otherDocumentFile;
  962. }
  963. public function setUpdated($updated)
  964. {
  965. $this->updated = $updated;
  966. }
  967. public function getUpdated()
  968. {
  969. return $this->updated;
  970. }
  971. public function refreshUpdated()
  972. {
  973. $this->setUpdated(new \DateTime());
  974. }
  975. /**
  976. * @return UploadedFile
  977. */
  978. public function getPictureFile()
  979. {
  980. return $this->pictureFile;
  981. }
  982. /**
  983. * @return UploadedFile
  984. */
  985. public function getDriverLicencePictureFile()
  986. {
  987. return $this->driverLicencePictureFile;
  988. }
  989. /**
  990. * @return UploadedFile
  991. */
  992. public function getPcoLicenseFileFile()
  993. {
  994. return $this->pcoLicenseFileFile;
  995. }
  996. /**
  997. * @return UploadedFile
  998. */
  999. public function getProofOfRightToWorkFile()
  1000. {
  1001. return $this->proofOfRightToWorkFile;
  1002. }
  1003. /**
  1004. * @return UploadedFile
  1005. */
  1006. public function getHackLicenseFileFile()
  1007. {
  1008. return $this->hackLicenseFileFile;
  1009. }
  1010. /**
  1011. * @return UploadedFile
  1012. */
  1013. public function getNinoFileFile()
  1014. {
  1015. return $this->ninoFileFile;
  1016. }
  1017. /**
  1018. * @return UploadedFile
  1019. */
  1020. public function getDbsCriminalCheckFileFile()
  1021. {
  1022. return $this->dbsCriminalCheckFileFile;
  1023. }
  1024. /**
  1025. * @return UploadedFile
  1026. */
  1027. public function getDriverAgreementFileFile()
  1028. {
  1029. return $this->driverAgreementFileFile;
  1030. }
  1031. /**
  1032. * @return UploadedFile
  1033. */
  1034. public function getOtherDocumentFile()
  1035. {
  1036. return $this->otherDocumentFile;
  1037. }
  1038. public function getPicturePath()
  1039. {
  1040. if (!$this->picture) {
  1041. return;
  1042. }
  1043. return $this->getUploadFilePath() . $this->picture;
  1044. }
  1045. public function getDriverLicencePicturePath()
  1046. {
  1047. if (!$this->driverLicencePicture) {
  1048. return;
  1049. }
  1050. return $this->getUploadFilePath() . $this->driverLicencePicture;
  1051. }
  1052. public function getPcoLicenseFilePath()
  1053. {
  1054. if (!$this->pcoLicenseFile) {
  1055. return;
  1056. }
  1057. return $this->getUploadFilePath() . $this->pcoLicenseFile;
  1058. }
  1059. public function getProofOfRightToWorkFilePath()
  1060. {
  1061. if (!$this->proofOfRightToWork) {
  1062. return;
  1063. }
  1064. return $this->getUploadFilePath() . $this->proofOfRightToWork;
  1065. }
  1066. public function getNinoFilePath()
  1067. {
  1068. if (!$this->ninoFile) {
  1069. return;
  1070. }
  1071. return $this->getUploadFilePath() . $this->ninoFile;
  1072. }
  1073. public function getHackLicenseFilePath()
  1074. {
  1075. if (!$this->hackLicenseFile) {
  1076. return;
  1077. }
  1078. return $this->getUploadFilePath() . $this->hackLicenseFile;
  1079. }
  1080. public function getDbsCriminalCheckFilePath()
  1081. {
  1082. if (!$this->dbsCriminalCheckFile) {
  1083. return;
  1084. }
  1085. return $this->getUploadFilePath() . $this->dbsCriminalCheckFile;
  1086. }
  1087. public function getDriverAgreementFilePath()
  1088. {
  1089. if (!$this->driverAgreementFile) {
  1090. return;
  1091. }
  1092. return $this->getUploadFilePath() . $this->driverAgreementFile;
  1093. }
  1094. public function getOtherDocumentFilePath()
  1095. {
  1096. if (!$this->otherDocument) {
  1097. return;
  1098. }
  1099. return $this->getUploadFilePath() . $this->otherDocument;
  1100. }
  1101. public function getPicture()
  1102. {
  1103. return $this->picture;
  1104. }
  1105. public function getDriverLicencePicture()
  1106. {
  1107. return $this->driverLicencePicture;
  1108. }
  1109. /**
  1110. * @return array
  1111. */
  1112. public function getOffDays()
  1113. {
  1114. return $this->offDays;
  1115. }
  1116. /**
  1117. * @param array $offDays
  1118. */
  1119. public function setOffDays($offDays)
  1120. {
  1121. $this->offDays = $offDays;
  1122. }
  1123. /**
  1124. * @return float
  1125. */
  1126. public function getHomeAddressLat()
  1127. {
  1128. return $this->homeAddressLat;
  1129. }
  1130. /**
  1131. * @param float $homeAddressLat
  1132. */
  1133. public function setHomeAddressLat($homeAddressLat)
  1134. {
  1135. $this->homeAddressLat = $homeAddressLat;
  1136. }
  1137. /**
  1138. * @return float
  1139. */
  1140. public function getHomeAddressLng()
  1141. {
  1142. return $this->homeAddressLng;
  1143. }
  1144. /**
  1145. * @param float $homeAddressLng
  1146. */
  1147. public function setHomeAddressLng($homeAddressLng)
  1148. {
  1149. $this->homeAddressLng = $homeAddressLng;
  1150. }
  1151. /**
  1152. * @return float
  1153. */
  1154. public function getDepartureLocationLat()
  1155. {
  1156. return $this->departureLocationLat;
  1157. }
  1158. /**
  1159. * @param float $departureLocationLat
  1160. */
  1161. public function setDepartureLocationLat($departureLocationLat)
  1162. {
  1163. $this->departureLocationLat = $departureLocationLat;
  1164. }
  1165. /**
  1166. * @return float
  1167. */
  1168. public function getDepartureLocationLng()
  1169. {
  1170. return $this->departureLocationLng;
  1171. }
  1172. /**
  1173. * @param float $departureLocationLng
  1174. */
  1175. public function setDepartureLocationLng($departureLocationLng)
  1176. {
  1177. $this->departureLocationLng = $departureLocationLng;
  1178. }
  1179. /**
  1180. * @return float
  1181. */
  1182. public function getFavoriteAirportLat()
  1183. {
  1184. return $this->favoriteAirportLat;
  1185. }
  1186. /**
  1187. * @param float $favoriteAirportLat
  1188. */
  1189. public function setFavoriteAirportLat($favoriteAirportLat)
  1190. {
  1191. $this->favoriteAirportLat = $favoriteAirportLat;
  1192. }
  1193. /**
  1194. * @return mixed
  1195. */
  1196. public function getFavoriteAirportLng()
  1197. {
  1198. return $this->favoriteAirportLng;
  1199. }
  1200. /**
  1201. * @param mixed $favoriteAirportLng
  1202. */
  1203. public function setFavoriteAirportLng($favoriteAirportLng)
  1204. {
  1205. $this->favoriteAirportLng = $favoriteAirportLng;
  1206. }
  1207. /**
  1208. * @return bool
  1209. */
  1210. public function isAllDayShift()
  1211. {
  1212. return $this->allDayShift;
  1213. }
  1214. /**
  1215. * @param bool $allDayShift
  1216. */
  1217. public function setAllDayShift($allDayShift)
  1218. {
  1219. $this->allDayShift = $allDayShift;
  1220. }
  1221. public function getDayTimeShiftStartDateFormat()
  1222. {
  1223. $dayTimeShiftStart = new \DateTime();
  1224. $dayTimeShiftStart->setTime(
  1225. $this->dayTimeShiftStart->format('G'),
  1226. $this->dayTimeShiftStart->format('i'),
  1227. $this->dayTimeShiftStart->format('s')
  1228. );
  1229. return $dayTimeShiftStart;
  1230. }
  1231. public function getDayTimeShiftStart()
  1232. {
  1233. if (!$this->dayTimeShiftStart) {
  1234. return;
  1235. }
  1236. return $this->dayTimeShiftStart->format('H:i');
  1237. }
  1238. public function setDayTimeShiftStart($dayTimeShiftStart)
  1239. {
  1240. if (is_string($dayTimeShiftStart)) {
  1241. $timeArray = explode(':', $dayTimeShiftStart);
  1242. $dayTimeShiftStart = new \DateTime();
  1243. $dayTimeShiftStart->setTime($timeArray[0], $timeArray[1]);
  1244. }
  1245. if (!$this->dayTimeShiftStart) {
  1246. $this->dayTimeShiftStart = new \DateTime();
  1247. }
  1248. $date = clone $this->dayTimeShiftStart;
  1249. $date->setTime(
  1250. $dayTimeShiftStart->format('G'),
  1251. $dayTimeShiftStart->format('i'),
  1252. $dayTimeShiftStart->format('s')
  1253. );
  1254. $this->dayTimeShiftStart = $date;
  1255. }
  1256. public function getDayTimeShiftEndDateFormat()
  1257. {
  1258. $dayTimeShiftEnd = new \DateTime();
  1259. $dayTimeShiftEnd->setTime(
  1260. $this->dayTimeShiftEnd->format('G'),
  1261. $this->dayTimeShiftEnd->format('i'),
  1262. $this->dayTimeShiftEnd->format('s')
  1263. );
  1264. return $dayTimeShiftEnd;
  1265. }
  1266. public function getDayTimeShiftEnd()
  1267. {
  1268. if (!$this->dayTimeShiftEnd) {
  1269. return;
  1270. }
  1271. return $this->dayTimeShiftEnd->format('H:i');
  1272. }
  1273. public function setDayTimeShiftEnd($dayTimeShiftEnd)
  1274. {
  1275. if (is_string($dayTimeShiftEnd)) {
  1276. $timeArray = explode(':', $dayTimeShiftEnd);
  1277. $dayTimeShiftEnd = new \DateTime();
  1278. $dayTimeShiftEnd->setTime($timeArray[0], $timeArray[1]);
  1279. }
  1280. if (!$this->dayTimeShiftEnd) {
  1281. $this->dayTimeShiftEnd = new \DateTime();
  1282. }
  1283. $date = clone $this->dayTimeShiftEnd;
  1284. $date->setTime(
  1285. $dayTimeShiftEnd->format('G'),
  1286. $dayTimeShiftEnd->format('i'),
  1287. $dayTimeShiftEnd->format('s')
  1288. );
  1289. $this->dayTimeShiftEnd = $date;
  1290. }
  1291. public function getNightTimeShiftStartDateFormat()
  1292. {
  1293. $nightTimeShiftStart = new \DateTime();
  1294. $nightTimeShiftStart->setTime(
  1295. $this->nightTimeShiftStart->format('G'),
  1296. $this->nightTimeShiftStart->format('i'),
  1297. $this->nightTimeShiftStart->format('s')
  1298. );
  1299. return $nightTimeShiftStart;
  1300. }
  1301. public function getNightTimeShiftStart()
  1302. {
  1303. if (!$this->nightTimeShiftStart) {
  1304. return;
  1305. }
  1306. return $this->nightTimeShiftStart->format('H:i');
  1307. }
  1308. public function setNightTimeShiftStart($nightTimeShiftStart)
  1309. {
  1310. if (is_string($nightTimeShiftStart)) {
  1311. $timeArray = explode(':', $nightTimeShiftStart);
  1312. $nightTimeShiftStart = new \DateTime();
  1313. $nightTimeShiftStart->setTime($timeArray[0], $timeArray[1]);
  1314. }
  1315. if (!$this->nightTimeShiftStart) {
  1316. $this->nightTimeShiftStart = new \DateTime();
  1317. }
  1318. $date = clone $this->nightTimeShiftStart;
  1319. $date->setTime(
  1320. $nightTimeShiftStart->format('G'),
  1321. $nightTimeShiftStart->format('i'),
  1322. $nightTimeShiftStart->format('s')
  1323. );
  1324. $this->nightTimeShiftStart = $date;
  1325. }
  1326. public function getNightTimeShiftEndDateFormat()
  1327. {
  1328. $nightTimeShiftEnd = new \DateTime();
  1329. $nightTimeShiftEnd->setTime(
  1330. $this->nightTimeShiftEnd->format('G'),
  1331. $this->nightTimeShiftEnd->format('i'),
  1332. $this->nightTimeShiftEnd->format('s')
  1333. );
  1334. return $nightTimeShiftEnd;
  1335. }
  1336. public function getNightTimeShiftEnd()
  1337. {
  1338. if (!$this->nightTimeShiftEnd) {
  1339. return;
  1340. }
  1341. return $this->nightTimeShiftEnd->format('H:i');
  1342. }
  1343. public function setNightTimeShiftEnd($nightTimeShiftEnd)
  1344. {
  1345. if (is_string($nightTimeShiftEnd)) {
  1346. $timeArray = explode(':', $nightTimeShiftEnd);
  1347. $nightTimeShiftEnd = new \DateTime();
  1348. $nightTimeShiftEnd->setTime($timeArray[0], $timeArray[1]);
  1349. }
  1350. if (!$this->nightTimeShiftEnd) {
  1351. $this->nightTimeShiftEnd = new \DateTime();
  1352. }
  1353. $date = clone $this->dayTimeShiftEnd;
  1354. $date->setTime(
  1355. $nightTimeShiftEnd->format('G'),
  1356. $nightTimeShiftEnd->format('i'),
  1357. $nightTimeShiftEnd->format('s')
  1358. );
  1359. $this->nightTimeShiftEnd = $date;
  1360. }
  1361. public function uploadPicture()
  1362. {
  1363. if (null === $this->getPictureFile()) {
  1364. return;
  1365. }
  1366. $this->removePictureFile();
  1367. $filename = sha1(uniqid(mt_rand(), true));
  1368. $this->picture = $filename . '.' . $this->getPictureFile()->guessExtension();
  1369. header("Content-type: image/jpeg");
  1370. $image = new \Eventviva\ImageResize($this->getPictureFile());
  1371. $image->crop(413, 531, ImageResize::CROPCENTER);
  1372. $image->save($this->getUploadFilePath() . '/' . $this->picture);
  1373. // $resiziedPicture->move(
  1374. // $this->getUploadFilePath(),
  1375. // $this->picture
  1376. // );
  1377. }
  1378. public function uploadDriverLicencePicture()
  1379. {
  1380. if (null === $this->getDriverLicencePictureFile()) {
  1381. return;
  1382. }
  1383. $this->removeDriverLicencePictureFile();
  1384. $filename = sha1(uniqid(mt_rand(), true));
  1385. $this->driverLicencePicture = $filename . '.' . $this->getDriverLicencePictureFile()->guessExtension();
  1386. $this->getDriverLicencePictureFile()->move(
  1387. $this->getUploadFilePath(),
  1388. $this->driverLicencePicture
  1389. );
  1390. $this->setDriverLicencePictureFile(null);
  1391. }
  1392. public function uploadPcoLicenseFile()
  1393. {
  1394. if (null === $this->getPcoLicenseFileFile()) {
  1395. return;
  1396. }
  1397. $this->removePcoLicenseFileFile();
  1398. $nDate = new \DateTime();
  1399. $filename = 'PCO_LICENSE_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1400. $this->pcoLicenseFile = $filename . '.' . $this->getPcoLicenseFileFile()->guessExtension();
  1401. $this->getPcoLicenseFileFile()->move(
  1402. $this->getUploadFilePath(),
  1403. $this->pcoLicenseFile
  1404. );
  1405. $this->setPcoLicenseFileFile(null);
  1406. }
  1407. public function uploadProofOfRightToWorkFile()
  1408. {
  1409. if (null === $this->getProofOfRightToWorkFile()) {
  1410. return;
  1411. }
  1412. $this->removeProofOfRightToWorkFile();
  1413. $nDate = new \DateTime();
  1414. $filename = 'PROOF_OF_RIGHT_TO_WORK_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1415. $this->proofOfRightToWork = $filename . '.' . $this->getProofOfRightToWorkFile()->guessExtension();
  1416. $this->getProofOfRightToWorkFile()->move(
  1417. $this->getUploadFilePath(),
  1418. $this->proofOfRightToWork
  1419. );
  1420. $this->setProofOfRightToWorkFile(null);
  1421. }
  1422. public function uploadNinoFile()
  1423. {
  1424. if (null === $this->getNinoFileFile()) {
  1425. return;
  1426. }
  1427. $this->removeNinoFileFile();
  1428. $nDate = new \DateTime();
  1429. $filename = 'NINO_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1430. $this->ninoFile = $filename . '.' . $this->getNinoFileFile()->guessExtension();
  1431. $this->getNinoFileFile()->move(
  1432. $this->getUploadFilePath(),
  1433. $this->ninoFile
  1434. );
  1435. $this->setNinoFileFile(null);
  1436. }
  1437. public function uploadHackLicenseFile()
  1438. {
  1439. if (null === $this->getHackLicenseFileFile()) {
  1440. return;
  1441. }
  1442. $this->removeHackLicenseFile();
  1443. $nDate = new \DateTime();
  1444. $filename = 'HACK_LICENSE_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1445. $this->hackLicenseFile = $filename . '.' . $this->getHackLicenseFileFile()->guessExtension();
  1446. $this->getHackLicenseFileFile()->move(
  1447. $this->getUploadFilePath(),
  1448. $this->hackLicenseFile
  1449. );
  1450. $this->setHackLicenseFileFile(null);
  1451. }
  1452. public function uploadDbsCriminalCheckFile()
  1453. {
  1454. if (null === $this->getDbsCriminalCheckFileFile()) {
  1455. return;
  1456. }
  1457. $this->removeDbsCriminalCheckFileFile();
  1458. $nDate = new \DateTime();
  1459. $filename = 'DBS_CRIMINAL_CHECK_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1460. $this->dbsCriminalCheckFile = $filename . '.' . $this->getDbsCriminalCheckFileFile()->guessExtension();
  1461. $this->getDbsCriminalCheckFileFile()->move(
  1462. $this->getUploadFilePath(),
  1463. $this->dbsCriminalCheckFile
  1464. );
  1465. $this->setDbsCriminalCheckFileFile(null);
  1466. }
  1467. public function uploadDriverAgreementFile()
  1468. {
  1469. if (null === $this->getDriverAgreementFileFile()) {
  1470. return;
  1471. }
  1472. $this->removeDriverAgreementFileFile();
  1473. $nDate = new \DateTime();
  1474. $filename = 'DRIVER_AGREEMENT_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1475. $this->driverAgreementFile = $filename . '.' . $this->getDriverAgreementFileFile()->guessExtension();
  1476. $this->getDriverAgreementFileFile()->move(
  1477. $this->getUploadFilePath(),
  1478. $this->driverAgreementFile
  1479. );
  1480. $this->setDriverAgreementFileFile(null);
  1481. }
  1482. public function uploadOtherDocumentFile()
  1483. {
  1484. if (null === $this->getOtherDocumentFile()) {
  1485. return;
  1486. }
  1487. $this->removeOtherDocumentFile();
  1488. $nDate = new \DateTime();
  1489. $filename = 'OTHER_DOCUMENT_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1490. $this->otherDocument = $filename . '.' . $this->getOtherDocumentFile()->guessExtension();
  1491. $this->getOtherDocumentFile()->move(
  1492. $this->getUploadFilePath(),
  1493. $this->otherDocument
  1494. );
  1495. $this->setOtherDocumentFile(null);
  1496. }
  1497. public function getUploadFilePath()
  1498. {
  1499. if (!is_dir(self::DRIVER_FILE_FOLDER . $this->id)) {
  1500. mkdir(self::DRIVER_FILE_FOLDER . $this->id, 0777, true);
  1501. }
  1502. return self::DRIVER_FILE_FOLDER . $this->id . '/';
  1503. }
  1504. #[ORM\PreUpdate]
  1505. #[ORM\PrePersist]
  1506. public function lifecycleFileUpload()
  1507. {
  1508. $this->uploadPicture();
  1509. $this->uploadProofOfRightToWorkFile();
  1510. $this->uploadHackLicenseFile();
  1511. $this->uploadDriverLicencePicture();
  1512. $this->uploadPcoLicenseFile();
  1513. $this->uploadDbsCriminalCheckFile();
  1514. $this->uploadNinoFile();
  1515. $this->uploadDriverAgreementFile();
  1516. $this->uploadOtherDocumentFile();
  1517. }
  1518. #[ORM\PrePersist]
  1519. #[ORM\PreUpdate]
  1520. public function updatedTimestamps()
  1521. {
  1522. $this->setUpdated(new \DateTime());
  1523. }
  1524. #[ORM\PostRemove]
  1525. public function removeUpload()
  1526. {
  1527. $this->removePictureFile();
  1528. $this->removeProofOfRightToWorkFile();
  1529. $this->removeHackLicenseFile();
  1530. $this->removeDriverLicencePictureFile();
  1531. $this->removePcoLicenseFileFile();
  1532. $this->removeNinoFileFile();
  1533. $this->removeDbsCriminalCheckFileFile();
  1534. $this->removeDriverAgreementFileFile();
  1535. $this->removeOtherDocumentFile();
  1536. }
  1537. public function removePictureFile()
  1538. {
  1539. if ($pictureFile = $this->getPicturePath()) {
  1540. @unlink($pictureFile);
  1541. }
  1542. }
  1543. public function removeDriverLicencePictureFile()
  1544. {
  1545. if ($driverLicencePictureFile = $this->getDriverLicencePicturePath()) {
  1546. @unlink($driverLicencePictureFile);
  1547. }
  1548. }
  1549. public function removePcoLicenseFileFile()
  1550. {
  1551. if ($pcoLicenseFileFile = $this->getPcoLicenseFilePath()) {
  1552. @unlink($pcoLicenseFileFile);
  1553. }
  1554. }
  1555. public function removeHackLicenseFile()
  1556. {
  1557. if ($hackLicenseFileFile = $this->getHackLicenseFilePath()) {
  1558. @unlink($hackLicenseFileFile);
  1559. }
  1560. }
  1561. public function removeProofOfRightToWorkFile()
  1562. {
  1563. if ($proofOfRightToWorkFile = $this->getProofOfRightToWorkFilePath()) {
  1564. @unlink($proofOfRightToWorkFile);
  1565. }
  1566. }
  1567. public function removeNinoFileFile()
  1568. {
  1569. if ($ninoFileFile = $this->getNinoFilePath()) {
  1570. @unlink($ninoFileFile);
  1571. }
  1572. }
  1573. public function removeDbsCriminalCheckFileFile()
  1574. {
  1575. if ($dbsCriminalCheckFileFile = $this->getDbsCriminalCheckFilePath()) {
  1576. @unlink($dbsCriminalCheckFileFile);
  1577. }
  1578. }
  1579. public function removeDriverAgreementFileFile()
  1580. {
  1581. if ($driverAgreementFileFile = $this->getDriverAgreementFilePath()) {
  1582. @unlink($driverAgreementFileFile);
  1583. }
  1584. }
  1585. public function removeOtherDocumentFile()
  1586. {
  1587. if ($otherDocumentFile = $this->getOtherDocumentFilePath()) {
  1588. @unlink($otherDocumentFile);
  1589. }
  1590. }
  1591. public function getUser()
  1592. {
  1593. return $this->user;
  1594. }
  1595. public function setUser(User $user)
  1596. {
  1597. $this->user = $user;
  1598. }
  1599. /**
  1600. * @return Car
  1601. */
  1602. public function getCar()
  1603. {
  1604. return $this->car;
  1605. }
  1606. /**
  1607. * @param Car $car
  1608. */
  1609. public function setCar(Car $car = null)
  1610. {
  1611. $this->car = $car;
  1612. }
  1613. /**
  1614. * @return ArrayCollection
  1615. */
  1616. public function getBookings()
  1617. {
  1618. return $this->bookings;
  1619. }
  1620. /**
  1621. * @param Booking $bookings
  1622. */
  1623. public function setBookings(Booking $bookings)
  1624. {
  1625. $this->bookings = $bookings;
  1626. }
  1627. /**
  1628. * @return ArrayCollection
  1629. */
  1630. public function getBookingsRequest()
  1631. {
  1632. return $this->bookings_request;
  1633. }
  1634. /**
  1635. * @param BookingRequest $bookings_request
  1636. */
  1637. public function setBookingsRequest(BookingRequest $bookings_request)
  1638. {
  1639. $this->bookings_request = $bookings_request;
  1640. }
  1641. /**
  1642. * @return ArrayCollection
  1643. */
  1644. public function getBroadcastedDrivers()
  1645. {
  1646. return $this->broadcastedDrivers;
  1647. }
  1648. /**
  1649. * @param ArrayCollection $broadcastedDrivers
  1650. */
  1651. public function setBroadcastedDrivers($broadcastedDrivers)
  1652. {
  1653. $this->broadcastedDrivers = $broadcastedDrivers;
  1654. }
  1655. /**
  1656. * @return ArrayCollection
  1657. */
  1658. public function getUnassignedBookingsRequests()
  1659. {
  1660. return $this->unassignedBookingsRequests;
  1661. }
  1662. /**
  1663. * @param ArrayCollection $unassignedBookingsRequests
  1664. */
  1665. public function setUnassignedBookingsRequests($unassignedBookingsRequests)
  1666. {
  1667. $this->unassignedBookingsRequests = $unassignedBookingsRequests;
  1668. }
  1669. /**
  1670. * @return ArrayCollection
  1671. */
  1672. public function getNotificationBookingUpdates(): ArrayCollection
  1673. {
  1674. return $this->notificationBookingUpdates;
  1675. }
  1676. /**
  1677. * @param $notificationBookingUpdates
  1678. * @return Driver
  1679. */
  1680. public function setNotificationBookingUpdates($notificationBookingUpdates): Driver
  1681. {
  1682. $this->notificationBookingUpdates = $notificationBookingUpdates;
  1683. return $this;
  1684. }
  1685. /**
  1686. * @param NotificationBookingUpdate $notificationBookingUpdate
  1687. * @return Driver
  1688. */
  1689. public function addNotificationBookingUpdate(NotificationBookingUpdate $notificationBookingUpdate)
  1690. {
  1691. $this->notificationBookingUpdates->add($notificationBookingUpdate);
  1692. return $this;
  1693. }
  1694. //protected $activeVehicle;
  1695. //protected $currentDevice;
  1696. //protected $rackingEntityId";
  1697. public function __toString()
  1698. {
  1699. return $this->getId() ? (string) $this->getUser()->getEmail() : 'n\a';
  1700. }
  1701. /**
  1702. * @return Booking|null;
  1703. */
  1704. public function getActiveBooking()
  1705. {
  1706. $criteria = Criteria::create()->where(Criteria::expr()->in('status', [
  1707. Booking::STATUS_ON_THE_WAY, Booking::STATUS_ARRIVED_AND_WAITING,
  1708. Booking::STATUS_PASSENGER_ON_BOARD, Booking::STATUS_ABOUT_TO_DROP,
  1709. ]));
  1710. return $this->getBookings()->matching($criteria)->first();
  1711. }
  1712. public function getMarkerPicture()
  1713. {
  1714. $markersPicture = [
  1715. self::SIMPLE_STATUS_AVAILABLE => 'status_1.png',
  1716. self::SIMPLE_STATUS_BUSY => 'status_2.png',
  1717. self::SIMPLE_STATUS_END_OF_SHIFT => 'status_4.png',
  1718. self::STATUS_EMERGENCY => 'status_3.png',
  1719. ];
  1720. if (!empty($this->getActiveBooking())) {
  1721. return 'status_' . $this->getActiveBooking()->getStatus() . '.png';
  1722. }
  1723. return $markersPicture[$this->getSimpleStatus()];
  1724. }
  1725. /**
  1726. * Add invoice
  1727. *
  1728. * @param \AdminBundle\Entity\DriverInvoices $invoice
  1729. *
  1730. * @return Driver
  1731. */
  1732. public function addInvoice(\AdminBundle\Entity\DriverInvoices $invoice)
  1733. {
  1734. $this->invoices[] = $invoice;
  1735. return $this;
  1736. }
  1737. /**
  1738. * Remove invoice
  1739. *
  1740. * @param \AdminBundle\Entity\DriverInvoices $invoice
  1741. */
  1742. public function removeInvoice(\AdminBundle\Entity\DriverInvoices $invoice)
  1743. {
  1744. $this->invoices->removeElement($invoice);
  1745. }
  1746. /**
  1747. * Get invoices
  1748. *
  1749. * @return \Doctrine\Common\Collections\Collection
  1750. */
  1751. public function getInvoices()
  1752. {
  1753. return $this->invoices;
  1754. }
  1755. /**
  1756. * Set picture
  1757. *
  1758. * @param string $picture
  1759. *
  1760. * @return Driver
  1761. */
  1762. public function setPicture($picture)
  1763. {
  1764. $this->picture = $picture;
  1765. return $this;
  1766. }
  1767. /**
  1768. * Set driverLicencePicture
  1769. *
  1770. * @param string $driverLicencePicture
  1771. *
  1772. * @return Driver
  1773. */
  1774. public function setDriverLicencePicture($driverLicencePicture)
  1775. {
  1776. $this->driverLicencePicture = $driverLicencePicture;
  1777. return $this;
  1778. }
  1779. /**
  1780. * Add booking
  1781. *
  1782. * @param \AdminBundle\Entity\Booking $booking
  1783. *
  1784. * @return Driver
  1785. */
  1786. public function addBooking(\AdminBundle\Entity\Booking $booking)
  1787. {
  1788. $this->bookings[] = $booking;
  1789. return $this;
  1790. }
  1791. /**
  1792. * Remove booking
  1793. *
  1794. * @param \AdminBundle\Entity\Booking $booking
  1795. */
  1796. public function removeBooking(\AdminBundle\Entity\Booking $booking)
  1797. {
  1798. $this->bookings->removeElement($booking);
  1799. }
  1800. /**
  1801. * Add booking request
  1802. *
  1803. * @param \AdminBundle\Entity\BookingRequest $booking_request
  1804. *
  1805. * @return Driver
  1806. */
  1807. public function addBookingRequest(\AdminBundle\Entity\BookingRequest $booking_request)
  1808. {
  1809. $this->bookings_request[] = $booking_request;
  1810. return $this;
  1811. }
  1812. /**
  1813. * Remove booking request
  1814. *
  1815. * @param \AdminBundle\Entity\BookingRequest $booking_request
  1816. */
  1817. public function removeBookingRequest(\AdminBundle\Entity\BookingRequest $booking_request)
  1818. {
  1819. $this->bookings_request->removeElement($booking_request);
  1820. }
  1821. /**
  1822. * Add broadcastedDriver
  1823. *
  1824. * @param \AdminBundle\Entity\BroadcastedDriver $broadcastedDriver
  1825. *
  1826. * @return Driver
  1827. */
  1828. public function addBroadcastedDriver(\AdminBundle\Entity\BroadcastedDriver $broadcastedDriver)
  1829. {
  1830. $this->broadcastedDrivers[] = $broadcastedDriver;
  1831. return $this;
  1832. }
  1833. /**
  1834. * Remove broadcastedDriver
  1835. *
  1836. * @param \AdminBundle\Entity\BroadcastedDriver $broadcastedDriver
  1837. */
  1838. public function removeBroadcastedDriver(\AdminBundle\Entity\BroadcastedDriver $broadcastedDriver)
  1839. {
  1840. $this->broadcastedDrivers->removeElement($broadcastedDriver);
  1841. }
  1842. /**
  1843. * Remove notificationBookingUpdate
  1844. *
  1845. * @param \AdminBundle\Entity\NotificationBookingUpdate $notificationBookingUpdate
  1846. */
  1847. public function removeNotificationBookingUpdate(\AdminBundle\Entity\NotificationBookingUpdate $notificationBookingUpdate)
  1848. {
  1849. $this->notificationBookingUpdates->removeElement($notificationBookingUpdate);
  1850. }
  1851. /**
  1852. * Add historyCar
  1853. *
  1854. * @param \AdminBundle\Entity\DriverHistoryCars $historyCar
  1855. *
  1856. * @return Driver
  1857. */
  1858. public function addHistoryCar(\AdminBundle\Entity\DriverHistoryCars $historyCar)
  1859. {
  1860. $this->historyCars[] = $historyCar;
  1861. return $this;
  1862. }
  1863. /**
  1864. * Remove historyCar
  1865. *
  1866. * @param \AdminBundle\Entity\DriverHistoryCars $historyCar
  1867. */
  1868. public function removeHistoryCar(\AdminBundle\Entity\DriverHistoryCars $historyCar)
  1869. {
  1870. $this->historyCars->removeElement($historyCar);
  1871. }
  1872. /**
  1873. * Get historyCars
  1874. *
  1875. * @return \Doctrine\Common\Collections\Collection
  1876. */
  1877. public function getHistoryCars()
  1878. {
  1879. return $this->historyCars;
  1880. }
  1881. /**
  1882. * @return \DateTime
  1883. */
  1884. public function getEndDate()
  1885. {
  1886. return $this->endDate;
  1887. }
  1888. /**
  1889. * @param \DateTime $endDate
  1890. */
  1891. public function setEndDate($endDate)
  1892. {
  1893. $this->endDate = $endDate;
  1894. }
  1895. /**
  1896. * @return string
  1897. */
  1898. public function getNationality()
  1899. {
  1900. return $this->nationality;
  1901. }
  1902. /**
  1903. * @param string $nationality
  1904. */
  1905. public function setNationality($nationality)
  1906. {
  1907. $this->nationality = $nationality;
  1908. }
  1909. /**
  1910. * @return string
  1911. */
  1912. public function getNationalInsuranceNumber()
  1913. {
  1914. return $this->nationalInsuranceNumber;
  1915. }
  1916. /**
  1917. * @param string $nationalInsuranceNumber
  1918. */
  1919. public function setNationalInsuranceNumber($nationalInsuranceNumber)
  1920. {
  1921. $this->nationalInsuranceNumber = $nationalInsuranceNumber;
  1922. }
  1923. /**
  1924. * @return string
  1925. */
  1926. public function getBankSociety()
  1927. {
  1928. return $this->bankSociety;
  1929. }
  1930. /**
  1931. * @param string $bankSociety
  1932. */
  1933. public function setBankSociety($bankSociety)
  1934. {
  1935. $this->bankSociety = $bankSociety;
  1936. }
  1937. /**
  1938. * @return string
  1939. */
  1940. public function getBankSortCode()
  1941. {
  1942. return $this->bankSortCode;
  1943. }
  1944. /**
  1945. * @param string $bankSortCode
  1946. */
  1947. public function setBankSortCode($bankSortCode)
  1948. {
  1949. $this->bankSortCode = $bankSortCode;
  1950. }
  1951. /**
  1952. * @return string
  1953. */
  1954. public function getBankAccountNumber()
  1955. {
  1956. return $this->bankAccountNumber;
  1957. }
  1958. /**
  1959. * @param string $bankAccountNumber
  1960. */
  1961. public function setBankAccountNumber($bankAccountNumber)
  1962. {
  1963. $this->bankAccountNumber = $bankAccountNumber;
  1964. }
  1965. /**
  1966. * @return string
  1967. */
  1968. public function getPcoLicenseFile()
  1969. {
  1970. return $this->pcoLicenseFile;
  1971. }
  1972. /**
  1973. * @param string $pcoLicenseFile
  1974. */
  1975. public function setPcoLicenseFile($pcoLicenseFile)
  1976. {
  1977. $this->pcoLicenseFile = $pcoLicenseFile;
  1978. }
  1979. /**
  1980. * @return \DateTime
  1981. */
  1982. public function getHackLicenseExpirationDate()
  1983. {
  1984. return $this->hackLicenseExpirationDate;
  1985. }
  1986. /**
  1987. * @param \DateTime $hackLicenseExpirationDate
  1988. */
  1989. public function setHackLicenseExpirationDate($hackLicenseExpirationDate)
  1990. {
  1991. $this->hackLicenseExpirationDate = $hackLicenseExpirationDate;
  1992. }
  1993. /**
  1994. * @return string
  1995. */
  1996. public function getHackLicenseNumber()
  1997. {
  1998. return $this->hackLicenseNumber;
  1999. }
  2000. /**
  2001. * @param string $hackLicenseNumber
  2002. */
  2003. public function setHackLicenseNumber($hackLicenseNumber)
  2004. {
  2005. $this->hackLicenseNumber = $hackLicenseNumber;
  2006. }
  2007. /**
  2008. * @return string
  2009. */
  2010. public function getProofOfRightToWork()
  2011. {
  2012. return $this->proofOfRightToWork;
  2013. }
  2014. /**
  2015. * @param string $proofOfRightToWork
  2016. */
  2017. public function setProofOfRightToWork($proofOfRightToWork)
  2018. {
  2019. $this->proofOfRightToWork = $proofOfRightToWork;
  2020. }
  2021. /**
  2022. * @return string
  2023. */
  2024. public function getSocialSecurityNumber()
  2025. {
  2026. return $this->socialSecurityNumber;
  2027. }
  2028. /**
  2029. * @param string $socialSecurityNumber
  2030. */
  2031. public function setSocialSecurityNumber($socialSecurityNumber)
  2032. {
  2033. $this->socialSecurityNumber = $socialSecurityNumber;
  2034. }
  2035. /**
  2036. * @return string
  2037. */
  2038. public function getHackLicenseFile()
  2039. {
  2040. return $this->hackLicenseFile;
  2041. }
  2042. /**
  2043. * @param string $hackLicenseFile
  2044. */
  2045. public function setHackLicenseFile($hackLicenseFile)
  2046. {
  2047. $this->hackLicenseFile = $hackLicenseFile;
  2048. }
  2049. /**
  2050. * @return string
  2051. */
  2052. public function getNinoFile()
  2053. {
  2054. return $this->ninoFile;
  2055. }
  2056. /**
  2057. * @param string $ninoFile
  2058. */
  2059. public function setNinoFile($ninoFile)
  2060. {
  2061. $this->ninoFile = $ninoFile;
  2062. }
  2063. /**
  2064. * @return string
  2065. */
  2066. public function getDbsCriminalCheckFile()
  2067. {
  2068. return $this->dbsCriminalCheckFile;
  2069. }
  2070. /**
  2071. * @param string $dbsCriminalCheckFile
  2072. */
  2073. public function setDbsCriminalCheckFile($dbsCriminalCheckFile)
  2074. {
  2075. $this->dbsCriminalCheckFile = $dbsCriminalCheckFile;
  2076. }
  2077. /**
  2078. * @return string
  2079. */
  2080. public function getDriverAgreementFile()
  2081. {
  2082. return $this->driverAgreementFile;
  2083. }
  2084. /**
  2085. * @param string $driverAgreementFile
  2086. */
  2087. public function setDriverAgreementFile($driverAgreementFile)
  2088. {
  2089. $this->driverAgreementFile = $driverAgreementFile;
  2090. }
  2091. /**
  2092. * @return string
  2093. */
  2094. public function getOtherDocument()
  2095. {
  2096. return $this->otherDocument;
  2097. }
  2098. /**
  2099. * @param string $otherDocument
  2100. */
  2101. public function setOtherDocument($otherDocument)
  2102. {
  2103. $this->otherDocument = $otherDocument;
  2104. }
  2105. /**
  2106. * @return string
  2107. */
  2108. public function getHouseStreetNumber()
  2109. {
  2110. return $this->houseStreetNumber;
  2111. }
  2112. /**
  2113. * @param string $houseStreetNumber
  2114. */
  2115. public function setHouseStreetNumber($houseStreetNumber)
  2116. {
  2117. $this->houseStreetNumber = $houseStreetNumber;
  2118. }
  2119. /**
  2120. * @return float
  2121. */
  2122. public function getCommissionOfficeUpTo500()
  2123. {
  2124. return $this->commissionOfficeUpTo500;
  2125. }
  2126. /**
  2127. * @param float $commissionOfficeUpTo500
  2128. */
  2129. public function setCommissionOfficeUpTo500($commissionOfficeUpTo500)
  2130. {
  2131. $this->commissionOfficeUpTo500 = $commissionOfficeUpTo500;
  2132. }
  2133. /**
  2134. * @return float
  2135. */
  2136. public function getCommissionOfficeUpTo1000()
  2137. {
  2138. return $this->commissionOfficeUpTo1000;
  2139. }
  2140. /**
  2141. * @param float $commissionOfficeUpTo1000
  2142. */
  2143. public function setCommissionOfficeUpTo1000($commissionOfficeUpTo1000)
  2144. {
  2145. $this->commissionOfficeUpTo1000 = $commissionOfficeUpTo1000;
  2146. }
  2147. /**
  2148. * @return float
  2149. */
  2150. public function getCommissionOfficeUpTo1500()
  2151. {
  2152. return $this->commissionOfficeUpTo1500;
  2153. }
  2154. /**
  2155. * @param float $commissionOfficeUpTo1500
  2156. */
  2157. public function setCommissionOfficeUpTo1500($commissionOfficeUpTo1500)
  2158. {
  2159. $this->commissionOfficeUpTo1500 = $commissionOfficeUpTo1500;
  2160. }
  2161. /**
  2162. * @return float
  2163. */
  2164. public function getCommissionOfficeOver1500()
  2165. {
  2166. return $this->commissionOfficeOver1500;
  2167. }
  2168. /**
  2169. * @param float $commissionOfficeOver1500
  2170. */
  2171. public function setCommissionOfficeOver1500($commissionOfficeOver1500)
  2172. {
  2173. $this->commissionOfficeOver1500 = $commissionOfficeOver1500;
  2174. }
  2175. public function getStartLocation()
  2176. {
  2177. $departureLocation = null;
  2178. if ($this->getFavoriteAirportLat() && $this->getFavoriteAirportLng()) {
  2179. $departureLocation = [
  2180. 'lat' => $this->getFavoriteAirportLat(),
  2181. 'lng' => $this->getFavoriteAirportLng(),
  2182. ];
  2183. }
  2184. if ($this->getDepartureLocationLat() && $this->getDepartureLocationLng()) {
  2185. $departureLocation = [
  2186. 'lat' => $this->getDepartureLocationLat(),
  2187. 'lng' => $this->getDepartureLocationLng(),
  2188. ];
  2189. }
  2190. if ($this->getHomeAddressLat() && $this->getHomeAddressLng()) {
  2191. $departureLocation = [
  2192. 'lat' => $this->getHomeAddressLat(),
  2193. 'lng' => $this->getHomeAddressLng(),
  2194. ];
  2195. }
  2196. return $departureLocation;
  2197. }
  2198. /**
  2199. * @return \DateTime
  2200. */
  2201. public function getSuspendedUntilDate()
  2202. {
  2203. return $this->suspendedUntilDate;
  2204. }
  2205. /**
  2206. * @param \DateTime $suspendedUntilDate
  2207. */
  2208. public function setSuspendedUntilDate($suspendedUntilDate)
  2209. {
  2210. $this->suspendedUntilDate = $suspendedUntilDate;
  2211. }
  2212. /**
  2213. * Add driverHistory
  2214. *
  2215. * @param DriverHistory $driverHistory
  2216. *
  2217. * @return Driver
  2218. */
  2219. public function addDriverHistory(DriverHistory $driverHistory)
  2220. {
  2221. $this->driverHistory[] = $driverHistory;
  2222. return $this;
  2223. }
  2224. /**
  2225. * @param DriverHistory $driverHistory
  2226. */
  2227. public function removeDriverHistory(DriverHistory $driverHistory)
  2228. {
  2229. $this->driverHistory->removeElement($driverHistory);
  2230. }
  2231. /**
  2232. * @return \Doctrine\Common\Collections\Collection
  2233. */
  2234. public function getDriverHistory()
  2235. {
  2236. return $this->driverHistory;
  2237. }
  2238. /**
  2239. * @param float $internalReputation
  2240. */
  2241. public function setInternalReputation($internalReputation)
  2242. {
  2243. $this->internalReputation = $internalReputation;
  2244. return $this;
  2245. }
  2246. /**
  2247. * @return float
  2248. */
  2249. public function getInternalReputation()
  2250. {
  2251. return $this->internalReputation;
  2252. }
  2253. /**
  2254. * @param float $activityReputation
  2255. */
  2256. public function setActivityReputation($activityReputation)
  2257. {
  2258. $this->activityReputation = $activityReputation;
  2259. return $this;
  2260. }
  2261. /**
  2262. * @return float
  2263. */
  2264. public function getActivityReputation()
  2265. {
  2266. return $this->activityReputation;
  2267. }
  2268. /**
  2269. * @param integer $reputationPoints
  2270. */
  2271. public function setReputationPoints($reputationPoints)
  2272. {
  2273. $this->reputationPoints = $reputationPoints;
  2274. return $this;
  2275. }
  2276. /**
  2277. * @return integer
  2278. */
  2279. public function getReputationPoints()
  2280. {
  2281. return $this->reputationPoints;
  2282. }
  2283. /**
  2284. * @param integer $reputationPoints
  2285. */
  2286. public function addReputationPoints($reputationPoints)
  2287. {
  2288. $this->reputationPoints = $this->getReputationPoints() + $reputationPoints;
  2289. return $this;
  2290. }
  2291. public function getOverallRating()
  2292. {
  2293. $activityReputation = $this->getActivityReputation();
  2294. $internalReputation = $this->getInternalReputation();
  2295. return number_format((self::ACTIVITY_REPUTATION_PERCENTAGE * $activityReputation) / 100 + (self::INTERNAL_REPUTATION_PERCENTAGE * $internalReputation) / 100, 2);
  2296. }
  2297. /**
  2298. * @param integer $topReputationPoints
  2299. */
  2300. public function setTopReputationPoints($topReputationPoints)
  2301. {
  2302. $this->topReputationPoints = $topReputationPoints;
  2303. return $this;
  2304. }
  2305. /**
  2306. * @return integer
  2307. */
  2308. public function getTopReputationPoints()
  2309. {
  2310. return $this->topReputationPoints;
  2311. }
  2312. /**
  2313. * @param integer $newLinkedBookingCount
  2314. */
  2315. public function setNewLinkedBookingCount($newLinkedBookingCount)
  2316. {
  2317. $this->newLinkedBookingCount = $newLinkedBookingCount;
  2318. return $this;
  2319. }
  2320. /**
  2321. * @return integer
  2322. */
  2323. public function getNewLinkedBookingCount()
  2324. {
  2325. return $this->newLinkedBookingCount;
  2326. }
  2327. public function setDeactivatedUntil($deactivatedUntil)
  2328. {
  2329. $this->deactivatedUntil = $deactivatedUntil;
  2330. }
  2331. public function getDeactivatedUntil()
  2332. {
  2333. return $this->deactivatedUntil;
  2334. }
  2335. public function isDeactivated()
  2336. {
  2337. return new \DateTime() < $this->getDeactivatedUntil();
  2338. }
  2339. /**
  2340. * Get the value of driverTimeShifts
  2341. */
  2342. public function getDriverTimeShifts()
  2343. {
  2344. return $this->driverTimeShifts;
  2345. }
  2346. /**
  2347. * Set the value of driverTimeShifts
  2348. *
  2349. * @return Driver
  2350. */
  2351. public function setDriverTimeShifts(ArrayCollection $driverTimeShifts)
  2352. {
  2353. $this->driverTimeShifts = $driverTimeShifts;
  2354. return $this;
  2355. }
  2356. /**
  2357. * @param DriverTimeShifts $driverTimeShifts
  2358. *
  2359. * @return Driver
  2360. */
  2361. public function addDriverTimeShifts(DriverTimeShifts $driverTimeShifts)
  2362. {
  2363. $this->driverTimeShifts[] = $driverTimeShifts;
  2364. return $this;
  2365. }
  2366. /**
  2367. * @param DriverTimeShifts $driverTimeShifts
  2368. *
  2369. * @return Driver
  2370. */
  2371. public function removeDriverTimeShifts(DriverTimeShifts $driverTimeShifts)
  2372. {
  2373. $this->driverTimeShifts->removeElement($driverTimeShifts);
  2374. return $this;
  2375. }
  2376. /**
  2377. * Get the value of driverTimeShifts on last 7 days
  2378. */
  2379. public function getLatestDriverTimeShifts()
  2380. {
  2381. $shifts = [];
  2382. $startDate = new DateTime('-7 days');
  2383. foreach ($this->getDriverTimeShifts() as $shift) {
  2384. $shiftDate = $shift->getDate();
  2385. if ($shiftDate >= $startDate) {
  2386. $shifts[] = $shift;
  2387. }
  2388. }
  2389. return $shifts;
  2390. }
  2391. /**
  2392. * @param ArrayCollection $answers
  2393. */
  2394. public function setAnswers(ArrayCollection $answers)
  2395. {
  2396. $this->answers = $answers;
  2397. return $this;
  2398. }
  2399. /**
  2400. * @return ArrayCollection
  2401. */
  2402. public function getAnswers()
  2403. {
  2404. return $this->answers;
  2405. }
  2406. public function getQuestionnaires()
  2407. {
  2408. $questionnaires = [];
  2409. foreach ($this->getAnswers() as $answer) {
  2410. $question = $answer->getQuestion();
  2411. $questionnaire = $question->getQuestionnaire();
  2412. if (!isset($questionnaires[$questionnaire->getId()])) {
  2413. $questionnaires[$questionnaire->getId()] = [
  2414. 'id' => $questionnaire->getId(),
  2415. 'type' => $questionnaire->getType(),
  2416. 'title' => $questionnaire->getTitle(),
  2417. 'description' => $questionnaire->getDescription(),
  2418. 'questions' => [],
  2419. ];
  2420. }
  2421. $questionnaires[$questionnaire->getId()]['questions'][] = [
  2422. 'name' => $question->getName(),
  2423. 'value' => $answer->getValue(),
  2424. ];
  2425. }
  2426. return $questionnaires;
  2427. }
  2428. /**
  2429. * Get the value of driverHistoryQueues
  2430. */
  2431. public function getDriverHistoryQueues()
  2432. {
  2433. return $this->driverHistoryQueues;
  2434. }
  2435. /**
  2436. * Set the value of driverHistoryQueues
  2437. *
  2438. * @return Driver
  2439. */
  2440. public function setDriverHistoryQueues(ArrayCollection $driverHistoryQueues)
  2441. {
  2442. $this->driverHistoryQueues = $driverHistoryQueues;
  2443. return $this;
  2444. }
  2445. /**
  2446. * @param DriverHistoryQueue $driverHistoryQueue
  2447. *
  2448. * @return Driver
  2449. */
  2450. public function addDriverHistoryQueue(DriverHistoryQueue $driverHistoryQueue)
  2451. {
  2452. $this->driverHistoryQueues[] = $driverHistoryQueue;
  2453. return $this;
  2454. }
  2455. /**
  2456. * @param DriverHistoryQueue $driverHistoryQueue
  2457. *
  2458. * @return Driver
  2459. */
  2460. public function removeDriverHistoryQueue(DriverHistoryQueue $driverHistoryQueue)
  2461. {
  2462. $this->driverHistoryQueues->removeElement($driverHistoryQueue);
  2463. return $this;
  2464. }
  2465. /**
  2466. * Get the value of completed queues on last 14 days
  2467. */
  2468. public function getLatestCompletedQueues()
  2469. {
  2470. $completed = [];
  2471. $startDate = new DateTime('-14 days');
  2472. foreach ($this->getDriverHistoryQueues() as $queue) {
  2473. $queueDate = $queue->getCreatedAt();
  2474. if ($queueDate >= $startDate && $queue->getQueueTimeCompleted()) {
  2475. $completed[] = $queue;
  2476. }
  2477. }
  2478. return $completed;
  2479. }
  2480. /**
  2481. * Get the value of driverHistoryTimelogs
  2482. */
  2483. public function getDriverHistoryTimelogs()
  2484. {
  2485. return $this->driverHistoryTimelogs;
  2486. }
  2487. /**
  2488. * Set the value of driverHistoryTimelogs
  2489. *
  2490. * @return Driver
  2491. */
  2492. public function setDriverHistoryTimelogs(ArrayCollection $driverHistoryTimelogs)
  2493. {
  2494. $this->driverHistoryTimelogs = $driverHistoryTimelogs;
  2495. return $this;
  2496. }
  2497. /**
  2498. * @param DriverHistoryTimelogs $driverHistoryTimelogs
  2499. *
  2500. * @return Driver
  2501. */
  2502. public function addDriverHistoryTimelog(DriverHistoryTimelogs $driverHistoryTimelog)
  2503. {
  2504. $this->driverHistoryTimelogs[] = $driverHistoryTimelog;
  2505. return $this;
  2506. }
  2507. /**
  2508. * @param DriverHistoryTimelogs $driverHistoryTimelogs
  2509. *
  2510. * @return Driver
  2511. */
  2512. public function removeDriverHistoryTimelog(DriverHistoryTimelogs $driverHistoryTimelog)
  2513. {
  2514. $this->driverHistoryTimelogs->removeElement($driverHistoryTimelog);
  2515. return $this;
  2516. }
  2517. /**
  2518. * Get the value of completed queues on last 14 days
  2519. */
  2520. public function getLatestDriverTimelogs()
  2521. {
  2522. $timelogs = [];
  2523. $startDate = new DateTime('-14 days');
  2524. foreach ($this->getDriverHistoryTimelogs() as $timelog) {
  2525. $timelogDate = $timelog->getDate();
  2526. if ($timelogDate >= $startDate) {
  2527. $dailyTotal = $timelog->getDailyTotal();
  2528. $time = '00:00';
  2529. if ($dailyTotal > 1) {
  2530. $hours = floor($dailyTotal / 60);
  2531. $minutes = ($dailyTotal % 60);
  2532. $time = sprintf('%02d:%02d', $hours, $minutes);
  2533. }
  2534. $timelogs[] = [
  2535. 'date' => $timelogDate,
  2536. 'time' => $time,
  2537. ];
  2538. }
  2539. }
  2540. return $timelogs;
  2541. }
  2542. /**
  2543. * @return string
  2544. */
  2545. public function getReferralCode()
  2546. {
  2547. return self::REFERRAL_CODE_PREFIX . $this->getInternalName();
  2548. }
  2549. /**
  2550. * Get userHistory
  2551. *
  2552. * @return Array
  2553. */
  2554. public static function getUserHistory()
  2555. {
  2556. return [];
  2557. }
  2558. }