src/AdminBundle/Entity/Driver.php line 19

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 Gumlet\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. intval($this->dayTimeShiftStart->format('G')),
  1226. intval($this->dayTimeShiftStart->format('i')),
  1227. intval($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(
  1244. intval($timeArray[0]),
  1245. intval($timeArray[1])
  1246. );
  1247. }
  1248. if (!$this->dayTimeShiftStart) {
  1249. $this->dayTimeShiftStart = new \DateTime();
  1250. }
  1251. $date = clone $this->dayTimeShiftStart;
  1252. $date->setTime(
  1253. intval($dayTimeShiftStart->format('G')),
  1254. intval($dayTimeShiftStart->format('i')),
  1255. intval($dayTimeShiftStart->format('s'))
  1256. );
  1257. $this->dayTimeShiftStart = $date;
  1258. }
  1259. public function getDayTimeShiftEndDateFormat()
  1260. {
  1261. $dayTimeShiftEnd = new \DateTime();
  1262. $dayTimeShiftEnd->setTime(
  1263. intval($this->dayTimeShiftEnd->format('G')),
  1264. intval($this->dayTimeShiftEnd->format('i')),
  1265. intval($this->dayTimeShiftEnd->format('s'))
  1266. );
  1267. return $dayTimeShiftEnd;
  1268. }
  1269. public function getDayTimeShiftEnd()
  1270. {
  1271. if (!$this->dayTimeShiftEnd) {
  1272. return;
  1273. }
  1274. return $this->dayTimeShiftEnd->format('H:i');
  1275. }
  1276. public function setDayTimeShiftEnd($dayTimeShiftEnd)
  1277. {
  1278. if (is_string($dayTimeShiftEnd)) {
  1279. $timeArray = explode(':', $dayTimeShiftEnd);
  1280. $dayTimeShiftEnd = new \DateTime();
  1281. $dayTimeShiftEnd->setTime(
  1282. intval($timeArray[0]),
  1283. intval($timeArray[1])
  1284. );
  1285. }
  1286. if (!$this->dayTimeShiftEnd) {
  1287. $this->dayTimeShiftEnd = new \DateTime();
  1288. }
  1289. $date = clone $this->dayTimeShiftEnd;
  1290. $date->setTime(
  1291. intval($dayTimeShiftEnd->format('G')),
  1292. intval($dayTimeShiftEnd->format('i')),
  1293. intval($dayTimeShiftEnd->format('s'))
  1294. );
  1295. $this->dayTimeShiftEnd = $date;
  1296. }
  1297. public function getNightTimeShiftStartDateFormat()
  1298. {
  1299. $nightTimeShiftStart = new \DateTime();
  1300. $nightTimeShiftStart->setTime(
  1301. intval($this->nightTimeShiftStart->format('G')),
  1302. intval($this->nightTimeShiftStart->format('i')),
  1303. intval($this->nightTimeShiftStart->format('s'))
  1304. );
  1305. return $nightTimeShiftStart;
  1306. }
  1307. public function getNightTimeShiftStart()
  1308. {
  1309. if (!$this->nightTimeShiftStart) {
  1310. return;
  1311. }
  1312. return $this->nightTimeShiftStart->format('H:i');
  1313. }
  1314. public function setNightTimeShiftStart($nightTimeShiftStart)
  1315. {
  1316. if (is_string($nightTimeShiftStart)) {
  1317. $timeArray = explode(':', $nightTimeShiftStart);
  1318. $nightTimeShiftStart = new \DateTime();
  1319. $nightTimeShiftStart->setTime(
  1320. intval($timeArray[0]),
  1321. intval($timeArray[1])
  1322. );
  1323. }
  1324. if (!$this->nightTimeShiftStart) {
  1325. $this->nightTimeShiftStart = new \DateTime();
  1326. }
  1327. $date = clone $this->nightTimeShiftStart;
  1328. $date->setTime(
  1329. intval($nightTimeShiftStart->format('G')),
  1330. intval($nightTimeShiftStart->format('i')),
  1331. intval($nightTimeShiftStart->format('s'))
  1332. );
  1333. $this->nightTimeShiftStart = $date;
  1334. }
  1335. public function getNightTimeShiftEndDateFormat()
  1336. {
  1337. $nightTimeShiftEnd = new \DateTime();
  1338. $nightTimeShiftEnd->setTime(
  1339. intval($this->nightTimeShiftEnd->format('G')),
  1340. intval($this->nightTimeShiftEnd->format('i')),
  1341. intval($this->nightTimeShiftEnd->format('s'))
  1342. );
  1343. return $nightTimeShiftEnd;
  1344. }
  1345. public function getNightTimeShiftEnd()
  1346. {
  1347. if (!$this->nightTimeShiftEnd) {
  1348. return;
  1349. }
  1350. return $this->nightTimeShiftEnd->format('H:i');
  1351. }
  1352. public function setNightTimeShiftEnd($nightTimeShiftEnd)
  1353. {
  1354. if (is_string($nightTimeShiftEnd)) {
  1355. $timeArray = explode(':', $nightTimeShiftEnd);
  1356. $nightTimeShiftEnd = new \DateTime();
  1357. $nightTimeShiftEnd->setTime(
  1358. intval($timeArray[0]),
  1359. intval($timeArray[1])
  1360. );
  1361. }
  1362. if (!$this->nightTimeShiftEnd) {
  1363. $this->nightTimeShiftEnd = new \DateTime();
  1364. }
  1365. $date = clone $this->dayTimeShiftEnd;
  1366. $date->setTime(
  1367. intval($nightTimeShiftEnd->format('G')),
  1368. intval($nightTimeShiftEnd->format('i')),
  1369. intval($nightTimeShiftEnd->format('s'))
  1370. );
  1371. $this->nightTimeShiftEnd = $date;
  1372. }
  1373. public function uploadPicture()
  1374. {
  1375. if (null === $this->getPictureFile()) {
  1376. return;
  1377. }
  1378. $this->removePictureFile();
  1379. $filename = sha1(uniqid(mt_rand(), true));
  1380. $this->picture = $filename . '.' . $this->getPictureFile()->guessExtension();
  1381. header("Content-type: image/jpeg");
  1382. $image = new ImageResize($this->getPictureFile());
  1383. $image->crop(413, 531, ImageResize::CROPCENTER);
  1384. $image->save($this->getUploadFilePath() . '/' . $this->picture);
  1385. // $resiziedPicture->move(
  1386. // $this->getUploadFilePath(),
  1387. // $this->picture
  1388. // );
  1389. }
  1390. public function uploadDriverLicencePicture()
  1391. {
  1392. if (null === $this->getDriverLicencePictureFile()) {
  1393. return;
  1394. }
  1395. $this->removeDriverLicencePictureFile();
  1396. $filename = sha1(uniqid(mt_rand(), true));
  1397. $this->driverLicencePicture = $filename . '.' . $this->getDriverLicencePictureFile()->guessExtension();
  1398. $this->getDriverLicencePictureFile()->move(
  1399. $this->getUploadFilePath(),
  1400. $this->driverLicencePicture
  1401. );
  1402. $this->setDriverLicencePictureFile(null);
  1403. }
  1404. public function uploadPcoLicenseFile()
  1405. {
  1406. if (null === $this->getPcoLicenseFileFile()) {
  1407. return;
  1408. }
  1409. $this->removePcoLicenseFileFile();
  1410. $nDate = new \DateTime();
  1411. $filename = 'PCO_LICENSE_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1412. $this->pcoLicenseFile = $filename . '.' . $this->getPcoLicenseFileFile()->guessExtension();
  1413. $this->getPcoLicenseFileFile()->move(
  1414. $this->getUploadFilePath(),
  1415. $this->pcoLicenseFile
  1416. );
  1417. $this->setPcoLicenseFileFile(null);
  1418. }
  1419. public function uploadProofOfRightToWorkFile()
  1420. {
  1421. if (null === $this->getProofOfRightToWorkFile()) {
  1422. return;
  1423. }
  1424. $this->removeProofOfRightToWorkFile();
  1425. $nDate = new \DateTime();
  1426. $filename = 'PROOF_OF_RIGHT_TO_WORK_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1427. $this->proofOfRightToWork = $filename . '.' . $this->getProofOfRightToWorkFile()->guessExtension();
  1428. $this->getProofOfRightToWorkFile()->move(
  1429. $this->getUploadFilePath(),
  1430. $this->proofOfRightToWork
  1431. );
  1432. $this->setProofOfRightToWorkFile(null);
  1433. }
  1434. public function uploadNinoFile()
  1435. {
  1436. if (null === $this->getNinoFileFile()) {
  1437. return;
  1438. }
  1439. $this->removeNinoFileFile();
  1440. $nDate = new \DateTime();
  1441. $filename = 'NINO_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1442. $this->ninoFile = $filename . '.' . $this->getNinoFileFile()->guessExtension();
  1443. $this->getNinoFileFile()->move(
  1444. $this->getUploadFilePath(),
  1445. $this->ninoFile
  1446. );
  1447. $this->setNinoFileFile(null);
  1448. }
  1449. public function uploadHackLicenseFile()
  1450. {
  1451. if (null === $this->getHackLicenseFileFile()) {
  1452. return;
  1453. }
  1454. $this->removeHackLicenseFile();
  1455. $nDate = new \DateTime();
  1456. $filename = 'HACK_LICENSE_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1457. $this->hackLicenseFile = $filename . '.' . $this->getHackLicenseFileFile()->guessExtension();
  1458. $this->getHackLicenseFileFile()->move(
  1459. $this->getUploadFilePath(),
  1460. $this->hackLicenseFile
  1461. );
  1462. $this->setHackLicenseFileFile(null);
  1463. }
  1464. public function uploadDbsCriminalCheckFile()
  1465. {
  1466. if (null === $this->getDbsCriminalCheckFileFile()) {
  1467. return;
  1468. }
  1469. $this->removeDbsCriminalCheckFileFile();
  1470. $nDate = new \DateTime();
  1471. $filename = 'DBS_CRIMINAL_CHECK_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1472. $this->dbsCriminalCheckFile = $filename . '.' . $this->getDbsCriminalCheckFileFile()->guessExtension();
  1473. $this->getDbsCriminalCheckFileFile()->move(
  1474. $this->getUploadFilePath(),
  1475. $this->dbsCriminalCheckFile
  1476. );
  1477. $this->setDbsCriminalCheckFileFile(null);
  1478. }
  1479. public function uploadDriverAgreementFile()
  1480. {
  1481. if (null === $this->getDriverAgreementFileFile()) {
  1482. return;
  1483. }
  1484. $this->removeDriverAgreementFileFile();
  1485. $nDate = new \DateTime();
  1486. $filename = 'DRIVER_AGREEMENT_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1487. $this->driverAgreementFile = $filename . '.' . $this->getDriverAgreementFileFile()->guessExtension();
  1488. $this->getDriverAgreementFileFile()->move(
  1489. $this->getUploadFilePath(),
  1490. $this->driverAgreementFile
  1491. );
  1492. $this->setDriverAgreementFileFile(null);
  1493. }
  1494. public function uploadOtherDocumentFile()
  1495. {
  1496. if (null === $this->getOtherDocumentFile()) {
  1497. return;
  1498. }
  1499. $this->removeOtherDocumentFile();
  1500. $nDate = new \DateTime();
  1501. $filename = 'OTHER_DOCUMENT_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
  1502. $this->otherDocument = $filename . '.' . $this->getOtherDocumentFile()->guessExtension();
  1503. $this->getOtherDocumentFile()->move(
  1504. $this->getUploadFilePath(),
  1505. $this->otherDocument
  1506. );
  1507. $this->setOtherDocumentFile(null);
  1508. }
  1509. public function getUploadFilePath()
  1510. {
  1511. if (!is_dir(self::DRIVER_FILE_FOLDER . $this->id)) {
  1512. mkdir(self::DRIVER_FILE_FOLDER . $this->id, 0777, true);
  1513. }
  1514. return self::DRIVER_FILE_FOLDER . $this->id . '/';
  1515. }
  1516. #[ORM\PreUpdate]
  1517. #[ORM\PrePersist]
  1518. public function lifecycleFileUpload()
  1519. {
  1520. $this->uploadPicture();
  1521. $this->uploadProofOfRightToWorkFile();
  1522. $this->uploadHackLicenseFile();
  1523. $this->uploadDriverLicencePicture();
  1524. $this->uploadPcoLicenseFile();
  1525. $this->uploadDbsCriminalCheckFile();
  1526. $this->uploadNinoFile();
  1527. $this->uploadDriverAgreementFile();
  1528. $this->uploadOtherDocumentFile();
  1529. }
  1530. #[ORM\PrePersist]
  1531. #[ORM\PreUpdate]
  1532. public function updatedTimestamps()
  1533. {
  1534. $this->setUpdated(new \DateTime());
  1535. }
  1536. #[ORM\PostRemove]
  1537. public function removeUpload()
  1538. {
  1539. $this->removePictureFile();
  1540. $this->removeProofOfRightToWorkFile();
  1541. $this->removeHackLicenseFile();
  1542. $this->removeDriverLicencePictureFile();
  1543. $this->removePcoLicenseFileFile();
  1544. $this->removeNinoFileFile();
  1545. $this->removeDbsCriminalCheckFileFile();
  1546. $this->removeDriverAgreementFileFile();
  1547. $this->removeOtherDocumentFile();
  1548. }
  1549. public function removePictureFile()
  1550. {
  1551. if ($pictureFile = $this->getPicturePath()) {
  1552. @unlink($pictureFile);
  1553. }
  1554. }
  1555. public function removeDriverLicencePictureFile()
  1556. {
  1557. if ($driverLicencePictureFile = $this->getDriverLicencePicturePath()) {
  1558. @unlink($driverLicencePictureFile);
  1559. }
  1560. }
  1561. public function removePcoLicenseFileFile()
  1562. {
  1563. if ($pcoLicenseFileFile = $this->getPcoLicenseFilePath()) {
  1564. @unlink($pcoLicenseFileFile);
  1565. }
  1566. }
  1567. public function removeHackLicenseFile()
  1568. {
  1569. if ($hackLicenseFileFile = $this->getHackLicenseFilePath()) {
  1570. @unlink($hackLicenseFileFile);
  1571. }
  1572. }
  1573. public function removeProofOfRightToWorkFile()
  1574. {
  1575. if ($proofOfRightToWorkFile = $this->getProofOfRightToWorkFilePath()) {
  1576. @unlink($proofOfRightToWorkFile);
  1577. }
  1578. }
  1579. public function removeNinoFileFile()
  1580. {
  1581. if ($ninoFileFile = $this->getNinoFilePath()) {
  1582. @unlink($ninoFileFile);
  1583. }
  1584. }
  1585. public function removeDbsCriminalCheckFileFile()
  1586. {
  1587. if ($dbsCriminalCheckFileFile = $this->getDbsCriminalCheckFilePath()) {
  1588. @unlink($dbsCriminalCheckFileFile);
  1589. }
  1590. }
  1591. public function removeDriverAgreementFileFile()
  1592. {
  1593. if ($driverAgreementFileFile = $this->getDriverAgreementFilePath()) {
  1594. @unlink($driverAgreementFileFile);
  1595. }
  1596. }
  1597. public function removeOtherDocumentFile()
  1598. {
  1599. if ($otherDocumentFile = $this->getOtherDocumentFilePath()) {
  1600. @unlink($otherDocumentFile);
  1601. }
  1602. }
  1603. public function getUser()
  1604. {
  1605. return $this->user;
  1606. }
  1607. public function setUser(User $user)
  1608. {
  1609. $this->user = $user;
  1610. }
  1611. /**
  1612. * @return Car
  1613. */
  1614. public function getCar()
  1615. {
  1616. return $this->car;
  1617. }
  1618. /**
  1619. * @param Car $car
  1620. */
  1621. public function setCar(?Car $car = null)
  1622. {
  1623. $this->car = $car;
  1624. }
  1625. /**
  1626. * @return ArrayCollection
  1627. */
  1628. public function getBookings()
  1629. {
  1630. return $this->bookings;
  1631. }
  1632. /**
  1633. * @param Booking $bookings
  1634. */
  1635. public function setBookings(Booking $bookings)
  1636. {
  1637. $this->bookings = $bookings;
  1638. }
  1639. /**
  1640. * @return ArrayCollection
  1641. */
  1642. public function getBookingsRequest()
  1643. {
  1644. return $this->bookings_request;
  1645. }
  1646. /**
  1647. * @param BookingRequest $bookings_request
  1648. */
  1649. public function setBookingsRequest(BookingRequest $bookings_request)
  1650. {
  1651. $this->bookings_request = $bookings_request;
  1652. }
  1653. /**
  1654. * @return ArrayCollection
  1655. */
  1656. public function getBroadcastedDrivers()
  1657. {
  1658. return $this->broadcastedDrivers;
  1659. }
  1660. /**
  1661. * @param ArrayCollection $broadcastedDrivers
  1662. */
  1663. public function setBroadcastedDrivers($broadcastedDrivers)
  1664. {
  1665. $this->broadcastedDrivers = $broadcastedDrivers;
  1666. }
  1667. /**
  1668. * @return ArrayCollection
  1669. */
  1670. public function getUnassignedBookingsRequests()
  1671. {
  1672. return $this->unassignedBookingsRequests;
  1673. }
  1674. /**
  1675. * @param ArrayCollection $unassignedBookingsRequests
  1676. */
  1677. public function setUnassignedBookingsRequests($unassignedBookingsRequests)
  1678. {
  1679. $this->unassignedBookingsRequests = $unassignedBookingsRequests;
  1680. }
  1681. /**
  1682. * @return ArrayCollection
  1683. */
  1684. public function getNotificationBookingUpdates(): ArrayCollection
  1685. {
  1686. return $this->notificationBookingUpdates;
  1687. }
  1688. /**
  1689. * @param $notificationBookingUpdates
  1690. * @return Driver
  1691. */
  1692. public function setNotificationBookingUpdates($notificationBookingUpdates): Driver
  1693. {
  1694. $this->notificationBookingUpdates = $notificationBookingUpdates;
  1695. return $this;
  1696. }
  1697. /**
  1698. * @param NotificationBookingUpdate $notificationBookingUpdate
  1699. * @return Driver
  1700. */
  1701. public function addNotificationBookingUpdate(NotificationBookingUpdate $notificationBookingUpdate)
  1702. {
  1703. $this->notificationBookingUpdates->add($notificationBookingUpdate);
  1704. return $this;
  1705. }
  1706. //protected $activeVehicle;
  1707. //protected $currentDevice;
  1708. //protected $rackingEntityId";
  1709. public function __toString()
  1710. {
  1711. return $this->getId() ? (string) $this->getUser()->getEmail() : 'n\a';
  1712. }
  1713. /**
  1714. * @return Booking|null;
  1715. */
  1716. public function getActiveBooking()
  1717. {
  1718. $criteria = Criteria::create()->where(Criteria::expr()->in('status', [
  1719. Booking::STATUS_ON_THE_WAY, Booking::STATUS_ARRIVED_AND_WAITING,
  1720. Booking::STATUS_PASSENGER_ON_BOARD, Booking::STATUS_ABOUT_TO_DROP,
  1721. ]));
  1722. return $this->getBookings()->matching($criteria)->first();
  1723. }
  1724. public function getMarkerPicture()
  1725. {
  1726. $markersPicture = [
  1727. self::SIMPLE_STATUS_AVAILABLE => 'status_1.png',
  1728. self::SIMPLE_STATUS_BUSY => 'status_2.png',
  1729. self::SIMPLE_STATUS_END_OF_SHIFT => 'status_4.png',
  1730. self::STATUS_EMERGENCY => 'status_3.png',
  1731. ];
  1732. if (!empty($this->getActiveBooking())) {
  1733. return 'status_' . $this->getActiveBooking()->getStatus() . '.png';
  1734. }
  1735. return $markersPicture[$this->getSimpleStatus()];
  1736. }
  1737. /**
  1738. * Add invoice
  1739. *
  1740. * @param \AdminBundle\Entity\DriverInvoices $invoice
  1741. *
  1742. * @return Driver
  1743. */
  1744. public function addInvoice(\AdminBundle\Entity\DriverInvoices $invoice)
  1745. {
  1746. $this->invoices[] = $invoice;
  1747. return $this;
  1748. }
  1749. /**
  1750. * Remove invoice
  1751. *
  1752. * @param \AdminBundle\Entity\DriverInvoices $invoice
  1753. */
  1754. public function removeInvoice(\AdminBundle\Entity\DriverInvoices $invoice)
  1755. {
  1756. $this->invoices->removeElement($invoice);
  1757. }
  1758. /**
  1759. * Get invoices
  1760. *
  1761. * @return \Doctrine\Common\Collections\Collection
  1762. */
  1763. public function getInvoices()
  1764. {
  1765. return $this->invoices;
  1766. }
  1767. /**
  1768. * Set picture
  1769. *
  1770. * @param string $picture
  1771. *
  1772. * @return Driver
  1773. */
  1774. public function setPicture($picture)
  1775. {
  1776. $this->picture = $picture;
  1777. return $this;
  1778. }
  1779. /**
  1780. * Set driverLicencePicture
  1781. *
  1782. * @param string $driverLicencePicture
  1783. *
  1784. * @return Driver
  1785. */
  1786. public function setDriverLicencePicture($driverLicencePicture)
  1787. {
  1788. $this->driverLicencePicture = $driverLicencePicture;
  1789. return $this;
  1790. }
  1791. /**
  1792. * Add booking
  1793. *
  1794. * @param \AdminBundle\Entity\Booking $booking
  1795. *
  1796. * @return Driver
  1797. */
  1798. public function addBooking(\AdminBundle\Entity\Booking $booking)
  1799. {
  1800. $this->bookings[] = $booking;
  1801. return $this;
  1802. }
  1803. /**
  1804. * Remove booking
  1805. *
  1806. * @param \AdminBundle\Entity\Booking $booking
  1807. */
  1808. public function removeBooking(\AdminBundle\Entity\Booking $booking)
  1809. {
  1810. $this->bookings->removeElement($booking);
  1811. }
  1812. /**
  1813. * Add booking request
  1814. *
  1815. * @param \AdminBundle\Entity\BookingRequest $booking_request
  1816. *
  1817. * @return Driver
  1818. */
  1819. public function addBookingRequest(\AdminBundle\Entity\BookingRequest $booking_request)
  1820. {
  1821. $this->bookings_request[] = $booking_request;
  1822. return $this;
  1823. }
  1824. /**
  1825. * Remove booking request
  1826. *
  1827. * @param \AdminBundle\Entity\BookingRequest $booking_request
  1828. */
  1829. public function removeBookingRequest(\AdminBundle\Entity\BookingRequest $booking_request)
  1830. {
  1831. $this->bookings_request->removeElement($booking_request);
  1832. }
  1833. /**
  1834. * Add broadcastedDriver
  1835. *
  1836. * @param \AdminBundle\Entity\BroadcastedDriver $broadcastedDriver
  1837. *
  1838. * @return Driver
  1839. */
  1840. public function addBroadcastedDriver(\AdminBundle\Entity\BroadcastedDriver $broadcastedDriver)
  1841. {
  1842. $this->broadcastedDrivers[] = $broadcastedDriver;
  1843. return $this;
  1844. }
  1845. /**
  1846. * Remove broadcastedDriver
  1847. *
  1848. * @param \AdminBundle\Entity\BroadcastedDriver $broadcastedDriver
  1849. */
  1850. public function removeBroadcastedDriver(\AdminBundle\Entity\BroadcastedDriver $broadcastedDriver)
  1851. {
  1852. $this->broadcastedDrivers->removeElement($broadcastedDriver);
  1853. }
  1854. /**
  1855. * Remove notificationBookingUpdate
  1856. *
  1857. * @param \AdminBundle\Entity\NotificationBookingUpdate $notificationBookingUpdate
  1858. */
  1859. public function removeNotificationBookingUpdate(\AdminBundle\Entity\NotificationBookingUpdate $notificationBookingUpdate)
  1860. {
  1861. $this->notificationBookingUpdates->removeElement($notificationBookingUpdate);
  1862. }
  1863. /**
  1864. * Add historyCar
  1865. *
  1866. * @param \AdminBundle\Entity\DriverHistoryCars $historyCar
  1867. *
  1868. * @return Driver
  1869. */
  1870. public function addHistoryCar(\AdminBundle\Entity\DriverHistoryCars $historyCar)
  1871. {
  1872. $this->historyCars[] = $historyCar;
  1873. return $this;
  1874. }
  1875. /**
  1876. * Remove historyCar
  1877. *
  1878. * @param \AdminBundle\Entity\DriverHistoryCars $historyCar
  1879. */
  1880. public function removeHistoryCar(\AdminBundle\Entity\DriverHistoryCars $historyCar)
  1881. {
  1882. $this->historyCars->removeElement($historyCar);
  1883. }
  1884. /**
  1885. * Get historyCars
  1886. *
  1887. * @return \Doctrine\Common\Collections\Collection
  1888. */
  1889. public function getHistoryCars()
  1890. {
  1891. return $this->historyCars;
  1892. }
  1893. /**
  1894. * @return \DateTime
  1895. */
  1896. public function getEndDate()
  1897. {
  1898. return $this->endDate;
  1899. }
  1900. /**
  1901. * @param \DateTime $endDate
  1902. */
  1903. public function setEndDate($endDate)
  1904. {
  1905. $this->endDate = $endDate;
  1906. }
  1907. /**
  1908. * @return string
  1909. */
  1910. public function getNationality()
  1911. {
  1912. return $this->nationality;
  1913. }
  1914. /**
  1915. * @param string $nationality
  1916. */
  1917. public function setNationality($nationality)
  1918. {
  1919. $this->nationality = $nationality;
  1920. }
  1921. /**
  1922. * @return string
  1923. */
  1924. public function getNationalInsuranceNumber()
  1925. {
  1926. return $this->nationalInsuranceNumber;
  1927. }
  1928. /**
  1929. * @param string $nationalInsuranceNumber
  1930. */
  1931. public function setNationalInsuranceNumber($nationalInsuranceNumber)
  1932. {
  1933. $this->nationalInsuranceNumber = $nationalInsuranceNumber;
  1934. }
  1935. /**
  1936. * @return string
  1937. */
  1938. public function getBankSociety()
  1939. {
  1940. return $this->bankSociety;
  1941. }
  1942. /**
  1943. * @param string $bankSociety
  1944. */
  1945. public function setBankSociety($bankSociety)
  1946. {
  1947. $this->bankSociety = $bankSociety;
  1948. }
  1949. /**
  1950. * @return string
  1951. */
  1952. public function getBankSortCode()
  1953. {
  1954. return $this->bankSortCode;
  1955. }
  1956. /**
  1957. * @param string $bankSortCode
  1958. */
  1959. public function setBankSortCode($bankSortCode)
  1960. {
  1961. $this->bankSortCode = $bankSortCode;
  1962. }
  1963. /**
  1964. * @return string
  1965. */
  1966. public function getBankAccountNumber()
  1967. {
  1968. return $this->bankAccountNumber;
  1969. }
  1970. /**
  1971. * @param string $bankAccountNumber
  1972. */
  1973. public function setBankAccountNumber($bankAccountNumber)
  1974. {
  1975. $this->bankAccountNumber = $bankAccountNumber;
  1976. }
  1977. /**
  1978. * @return string
  1979. */
  1980. public function getPcoLicenseFile()
  1981. {
  1982. return $this->pcoLicenseFile;
  1983. }
  1984. /**
  1985. * @param string $pcoLicenseFile
  1986. */
  1987. public function setPcoLicenseFile($pcoLicenseFile)
  1988. {
  1989. $this->pcoLicenseFile = $pcoLicenseFile;
  1990. }
  1991. /**
  1992. * @return \DateTime
  1993. */
  1994. public function getHackLicenseExpirationDate()
  1995. {
  1996. return $this->hackLicenseExpirationDate;
  1997. }
  1998. /**
  1999. * @param \DateTime $hackLicenseExpirationDate
  2000. */
  2001. public function setHackLicenseExpirationDate($hackLicenseExpirationDate)
  2002. {
  2003. $this->hackLicenseExpirationDate = $hackLicenseExpirationDate;
  2004. }
  2005. /**
  2006. * @return string
  2007. */
  2008. public function getHackLicenseNumber()
  2009. {
  2010. return $this->hackLicenseNumber;
  2011. }
  2012. /**
  2013. * @param string $hackLicenseNumber
  2014. */
  2015. public function setHackLicenseNumber($hackLicenseNumber)
  2016. {
  2017. $this->hackLicenseNumber = $hackLicenseNumber;
  2018. }
  2019. /**
  2020. * @return string
  2021. */
  2022. public function getProofOfRightToWork()
  2023. {
  2024. return $this->proofOfRightToWork;
  2025. }
  2026. /**
  2027. * @param string $proofOfRightToWork
  2028. */
  2029. public function setProofOfRightToWork($proofOfRightToWork)
  2030. {
  2031. $this->proofOfRightToWork = $proofOfRightToWork;
  2032. }
  2033. /**
  2034. * @return string
  2035. */
  2036. public function getSocialSecurityNumber()
  2037. {
  2038. return $this->socialSecurityNumber;
  2039. }
  2040. /**
  2041. * @param string $socialSecurityNumber
  2042. */
  2043. public function setSocialSecurityNumber($socialSecurityNumber)
  2044. {
  2045. $this->socialSecurityNumber = $socialSecurityNumber;
  2046. }
  2047. /**
  2048. * @return string
  2049. */
  2050. public function getHackLicenseFile()
  2051. {
  2052. return $this->hackLicenseFile;
  2053. }
  2054. /**
  2055. * @param string $hackLicenseFile
  2056. */
  2057. public function setHackLicenseFile($hackLicenseFile)
  2058. {
  2059. $this->hackLicenseFile = $hackLicenseFile;
  2060. }
  2061. /**
  2062. * @return string
  2063. */
  2064. public function getNinoFile()
  2065. {
  2066. return $this->ninoFile;
  2067. }
  2068. /**
  2069. * @param string $ninoFile
  2070. */
  2071. public function setNinoFile($ninoFile)
  2072. {
  2073. $this->ninoFile = $ninoFile;
  2074. }
  2075. /**
  2076. * @return string
  2077. */
  2078. public function getDbsCriminalCheckFile()
  2079. {
  2080. return $this->dbsCriminalCheckFile;
  2081. }
  2082. /**
  2083. * @param string $dbsCriminalCheckFile
  2084. */
  2085. public function setDbsCriminalCheckFile($dbsCriminalCheckFile)
  2086. {
  2087. $this->dbsCriminalCheckFile = $dbsCriminalCheckFile;
  2088. }
  2089. /**
  2090. * @return string
  2091. */
  2092. public function getDriverAgreementFile()
  2093. {
  2094. return $this->driverAgreementFile;
  2095. }
  2096. /**
  2097. * @param string $driverAgreementFile
  2098. */
  2099. public function setDriverAgreementFile($driverAgreementFile)
  2100. {
  2101. $this->driverAgreementFile = $driverAgreementFile;
  2102. }
  2103. /**
  2104. * @return string
  2105. */
  2106. public function getOtherDocument()
  2107. {
  2108. return $this->otherDocument;
  2109. }
  2110. /**
  2111. * @param string $otherDocument
  2112. */
  2113. public function setOtherDocument($otherDocument)
  2114. {
  2115. $this->otherDocument = $otherDocument;
  2116. }
  2117. /**
  2118. * @return string
  2119. */
  2120. public function getHouseStreetNumber()
  2121. {
  2122. return $this->houseStreetNumber;
  2123. }
  2124. /**
  2125. * @param string $houseStreetNumber
  2126. */
  2127. public function setHouseStreetNumber($houseStreetNumber)
  2128. {
  2129. $this->houseStreetNumber = $houseStreetNumber;
  2130. }
  2131. /**
  2132. * @return float
  2133. */
  2134. public function getCommissionOfficeUpTo500()
  2135. {
  2136. return $this->commissionOfficeUpTo500;
  2137. }
  2138. /**
  2139. * @param float $commissionOfficeUpTo500
  2140. */
  2141. public function setCommissionOfficeUpTo500($commissionOfficeUpTo500)
  2142. {
  2143. $this->commissionOfficeUpTo500 = $commissionOfficeUpTo500;
  2144. }
  2145. /**
  2146. * @return float
  2147. */
  2148. public function getCommissionOfficeUpTo1000()
  2149. {
  2150. return $this->commissionOfficeUpTo1000;
  2151. }
  2152. /**
  2153. * @param float $commissionOfficeUpTo1000
  2154. */
  2155. public function setCommissionOfficeUpTo1000($commissionOfficeUpTo1000)
  2156. {
  2157. $this->commissionOfficeUpTo1000 = $commissionOfficeUpTo1000;
  2158. }
  2159. /**
  2160. * @return float
  2161. */
  2162. public function getCommissionOfficeUpTo1500()
  2163. {
  2164. return $this->commissionOfficeUpTo1500;
  2165. }
  2166. /**
  2167. * @param float $commissionOfficeUpTo1500
  2168. */
  2169. public function setCommissionOfficeUpTo1500($commissionOfficeUpTo1500)
  2170. {
  2171. $this->commissionOfficeUpTo1500 = $commissionOfficeUpTo1500;
  2172. }
  2173. /**
  2174. * @return float
  2175. */
  2176. public function getCommissionOfficeOver1500()
  2177. {
  2178. return $this->commissionOfficeOver1500;
  2179. }
  2180. /**
  2181. * @param float $commissionOfficeOver1500
  2182. */
  2183. public function setCommissionOfficeOver1500($commissionOfficeOver1500)
  2184. {
  2185. $this->commissionOfficeOver1500 = $commissionOfficeOver1500;
  2186. }
  2187. public function getStartLocation()
  2188. {
  2189. $departureLocation = null;
  2190. if ($this->getFavoriteAirportLat() && $this->getFavoriteAirportLng()) {
  2191. $departureLocation = [
  2192. 'lat' => $this->getFavoriteAirportLat(),
  2193. 'lng' => $this->getFavoriteAirportLng(),
  2194. ];
  2195. }
  2196. if ($this->getDepartureLocationLat() && $this->getDepartureLocationLng()) {
  2197. $departureLocation = [
  2198. 'lat' => $this->getDepartureLocationLat(),
  2199. 'lng' => $this->getDepartureLocationLng(),
  2200. ];
  2201. }
  2202. if ($this->getHomeAddressLat() && $this->getHomeAddressLng()) {
  2203. $departureLocation = [
  2204. 'lat' => $this->getHomeAddressLat(),
  2205. 'lng' => $this->getHomeAddressLng(),
  2206. ];
  2207. }
  2208. return $departureLocation;
  2209. }
  2210. /**
  2211. * @return \DateTime
  2212. */
  2213. public function getSuspendedUntilDate()
  2214. {
  2215. return $this->suspendedUntilDate;
  2216. }
  2217. /**
  2218. * @param \DateTime $suspendedUntilDate
  2219. */
  2220. public function setSuspendedUntilDate($suspendedUntilDate)
  2221. {
  2222. $this->suspendedUntilDate = $suspendedUntilDate;
  2223. }
  2224. /**
  2225. * Add driverHistory
  2226. *
  2227. * @param DriverHistory $driverHistory
  2228. *
  2229. * @return Driver
  2230. */
  2231. public function addDriverHistory(DriverHistory $driverHistory)
  2232. {
  2233. $this->driverHistory[] = $driverHistory;
  2234. return $this;
  2235. }
  2236. /**
  2237. * @param DriverHistory $driverHistory
  2238. */
  2239. public function removeDriverHistory(DriverHistory $driverHistory)
  2240. {
  2241. $this->driverHistory->removeElement($driverHistory);
  2242. }
  2243. /**
  2244. * @return \Doctrine\Common\Collections\Collection
  2245. */
  2246. public function getDriverHistory()
  2247. {
  2248. return $this->driverHistory;
  2249. }
  2250. /**
  2251. * @param float $internalReputation
  2252. */
  2253. public function setInternalReputation($internalReputation)
  2254. {
  2255. $this->internalReputation = $internalReputation;
  2256. return $this;
  2257. }
  2258. /**
  2259. * @return float
  2260. */
  2261. public function getInternalReputation()
  2262. {
  2263. return $this->internalReputation;
  2264. }
  2265. /**
  2266. * @param float $activityReputation
  2267. */
  2268. public function setActivityReputation($activityReputation)
  2269. {
  2270. $this->activityReputation = $activityReputation;
  2271. return $this;
  2272. }
  2273. /**
  2274. * @return float
  2275. */
  2276. public function getActivityReputation()
  2277. {
  2278. return $this->activityReputation;
  2279. }
  2280. /**
  2281. * @param integer $reputationPoints
  2282. */
  2283. public function setReputationPoints($reputationPoints)
  2284. {
  2285. $this->reputationPoints = $reputationPoints;
  2286. return $this;
  2287. }
  2288. /**
  2289. * @return integer
  2290. */
  2291. public function getReputationPoints()
  2292. {
  2293. return $this->reputationPoints;
  2294. }
  2295. /**
  2296. * @param integer $reputationPoints
  2297. */
  2298. public function addReputationPoints($reputationPoints)
  2299. {
  2300. $this->reputationPoints = $this->getReputationPoints() + $reputationPoints;
  2301. return $this;
  2302. }
  2303. public function getOverallRating()
  2304. {
  2305. $activityReputation = $this->getActivityReputation();
  2306. $internalReputation = $this->getInternalReputation();
  2307. return number_format((self::ACTIVITY_REPUTATION_PERCENTAGE * $activityReputation) / 100 + (self::INTERNAL_REPUTATION_PERCENTAGE * $internalReputation) / 100, 2);
  2308. }
  2309. /**
  2310. * @param integer $topReputationPoints
  2311. */
  2312. public function setTopReputationPoints($topReputationPoints)
  2313. {
  2314. $this->topReputationPoints = $topReputationPoints;
  2315. return $this;
  2316. }
  2317. /**
  2318. * @return integer
  2319. */
  2320. public function getTopReputationPoints()
  2321. {
  2322. return $this->topReputationPoints;
  2323. }
  2324. /**
  2325. * @param integer $newLinkedBookingCount
  2326. */
  2327. public function setNewLinkedBookingCount($newLinkedBookingCount)
  2328. {
  2329. $this->newLinkedBookingCount = $newLinkedBookingCount;
  2330. return $this;
  2331. }
  2332. /**
  2333. * @return integer
  2334. */
  2335. public function getNewLinkedBookingCount()
  2336. {
  2337. return $this->newLinkedBookingCount;
  2338. }
  2339. public function setDeactivatedUntil($deactivatedUntil)
  2340. {
  2341. $this->deactivatedUntil = $deactivatedUntil;
  2342. }
  2343. public function getDeactivatedUntil()
  2344. {
  2345. return $this->deactivatedUntil;
  2346. }
  2347. public function isDeactivated()
  2348. {
  2349. return new \DateTime() < $this->getDeactivatedUntil();
  2350. }
  2351. /**
  2352. * Get the value of driverTimeShifts
  2353. */
  2354. public function getDriverTimeShifts()
  2355. {
  2356. return $this->driverTimeShifts;
  2357. }
  2358. /**
  2359. * Set the value of driverTimeShifts
  2360. *
  2361. * @return Driver
  2362. */
  2363. public function setDriverTimeShifts(ArrayCollection $driverTimeShifts)
  2364. {
  2365. $this->driverTimeShifts = $driverTimeShifts;
  2366. return $this;
  2367. }
  2368. /**
  2369. * @param DriverTimeShifts $driverTimeShifts
  2370. *
  2371. * @return Driver
  2372. */
  2373. public function addDriverTimeShifts(DriverTimeShifts $driverTimeShifts)
  2374. {
  2375. $this->driverTimeShifts[] = $driverTimeShifts;
  2376. return $this;
  2377. }
  2378. /**
  2379. * @param DriverTimeShifts $driverTimeShifts
  2380. *
  2381. * @return Driver
  2382. */
  2383. public function removeDriverTimeShifts(DriverTimeShifts $driverTimeShifts)
  2384. {
  2385. $this->driverTimeShifts->removeElement($driverTimeShifts);
  2386. return $this;
  2387. }
  2388. /**
  2389. * Get the value of driverTimeShifts on last 7 days
  2390. */
  2391. public function getLatestDriverTimeShifts()
  2392. {
  2393. $shifts = [];
  2394. $startDate = new DateTime('-7 days');
  2395. foreach ($this->getDriverTimeShifts() as $shift) {
  2396. $shiftDate = $shift->getDate();
  2397. if ($shiftDate >= $startDate) {
  2398. $shifts[] = $shift;
  2399. }
  2400. }
  2401. return $shifts;
  2402. }
  2403. /**
  2404. * @param ArrayCollection $answers
  2405. */
  2406. public function setAnswers(ArrayCollection $answers)
  2407. {
  2408. $this->answers = $answers;
  2409. return $this;
  2410. }
  2411. /**
  2412. * @return ArrayCollection
  2413. */
  2414. public function getAnswers()
  2415. {
  2416. return $this->answers;
  2417. }
  2418. public function getQuestionnaires()
  2419. {
  2420. $questionnaires = [];
  2421. foreach ($this->getAnswers() as $answer) {
  2422. $question = $answer->getQuestion();
  2423. $questionnaire = $question->getQuestionnaire();
  2424. if (!isset($questionnaires[$questionnaire->getId()])) {
  2425. $questionnaires[$questionnaire->getId()] = [
  2426. 'id' => $questionnaire->getId(),
  2427. 'type' => $questionnaire->getType(),
  2428. 'title' => $questionnaire->getTitle(),
  2429. 'description' => $questionnaire->getDescription(),
  2430. 'questions' => [],
  2431. ];
  2432. }
  2433. $questionnaires[$questionnaire->getId()]['questions'][] = [
  2434. 'name' => $question->getName(),
  2435. 'value' => $answer->getValue(),
  2436. ];
  2437. }
  2438. return $questionnaires;
  2439. }
  2440. /**
  2441. * Get the value of driverHistoryQueues
  2442. */
  2443. public function getDriverHistoryQueues()
  2444. {
  2445. return $this->driverHistoryQueues;
  2446. }
  2447. /**
  2448. * Set the value of driverHistoryQueues
  2449. *
  2450. * @return Driver
  2451. */
  2452. public function setDriverHistoryQueues(ArrayCollection $driverHistoryQueues)
  2453. {
  2454. $this->driverHistoryQueues = $driverHistoryQueues;
  2455. return $this;
  2456. }
  2457. /**
  2458. * @param DriverHistoryQueue $driverHistoryQueue
  2459. *
  2460. * @return Driver
  2461. */
  2462. public function addDriverHistoryQueue(DriverHistoryQueue $driverHistoryQueue)
  2463. {
  2464. $this->driverHistoryQueues[] = $driverHistoryQueue;
  2465. return $this;
  2466. }
  2467. /**
  2468. * @param DriverHistoryQueue $driverHistoryQueue
  2469. *
  2470. * @return Driver
  2471. */
  2472. public function removeDriverHistoryQueue(DriverHistoryQueue $driverHistoryQueue)
  2473. {
  2474. $this->driverHistoryQueues->removeElement($driverHistoryQueue);
  2475. return $this;
  2476. }
  2477. /**
  2478. * Get the value of completed queues on last 14 days
  2479. */
  2480. public function getLatestCompletedQueues()
  2481. {
  2482. $completed = [];
  2483. $startDate = new DateTime('-14 days');
  2484. foreach ($this->getDriverHistoryQueues() as $queue) {
  2485. $queueDate = $queue->getCreatedAt();
  2486. if ($queueDate >= $startDate && $queue->getQueueTimeCompleted()) {
  2487. $completed[] = $queue;
  2488. }
  2489. }
  2490. return $completed;
  2491. }
  2492. /**
  2493. * Get the value of driverHistoryTimelogs
  2494. */
  2495. public function getDriverHistoryTimelogs()
  2496. {
  2497. return $this->driverHistoryTimelogs;
  2498. }
  2499. /**
  2500. * Set the value of driverHistoryTimelogs
  2501. *
  2502. * @return Driver
  2503. */
  2504. public function setDriverHistoryTimelogs(ArrayCollection $driverHistoryTimelogs)
  2505. {
  2506. $this->driverHistoryTimelogs = $driverHistoryTimelogs;
  2507. return $this;
  2508. }
  2509. /**
  2510. * @param DriverHistoryTimelogs $driverHistoryTimelogs
  2511. *
  2512. * @return Driver
  2513. */
  2514. public function addDriverHistoryTimelog(DriverHistoryTimelogs $driverHistoryTimelog)
  2515. {
  2516. $this->driverHistoryTimelogs[] = $driverHistoryTimelog;
  2517. return $this;
  2518. }
  2519. /**
  2520. * @param DriverHistoryTimelogs $driverHistoryTimelogs
  2521. *
  2522. * @return Driver
  2523. */
  2524. public function removeDriverHistoryTimelog(DriverHistoryTimelogs $driverHistoryTimelog)
  2525. {
  2526. $this->driverHistoryTimelogs->removeElement($driverHistoryTimelog);
  2527. return $this;
  2528. }
  2529. /**
  2530. * Get the value of completed queues on last 14 days
  2531. */
  2532. public function getLatestDriverTimelogs()
  2533. {
  2534. $timelogs = [];
  2535. $startDate = new DateTime('-14 days');
  2536. foreach ($this->getDriverHistoryTimelogs() as $timelog) {
  2537. $timelogDate = $timelog->getDate();
  2538. if ($timelogDate >= $startDate) {
  2539. $dailyTotal = $timelog->getDailyTotal();
  2540. $time = '00:00';
  2541. if ($dailyTotal > 1) {
  2542. $hours = floor($dailyTotal / 60);
  2543. $minutes = ($dailyTotal % 60);
  2544. $time = sprintf('%02d:%02d', $hours, $minutes);
  2545. }
  2546. $timelogs[] = [
  2547. 'date' => $timelogDate,
  2548. 'time' => $time,
  2549. ];
  2550. }
  2551. }
  2552. return $timelogs;
  2553. }
  2554. /**
  2555. * @return string
  2556. */
  2557. public function getReferralCode()
  2558. {
  2559. return self::REFERRAL_CODE_PREFIX . $this->getInternalName();
  2560. }
  2561. /**
  2562. * Get userHistory
  2563. *
  2564. * @return Array
  2565. */
  2566. public static function getUserHistory()
  2567. {
  2568. return [];
  2569. }
  2570. }