<?php
namespace AdminBundle\Entity;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Mapping as ORM;
use Eventviva\ImageResize;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* Driver
*/
#[ORM\Table(name: 'driver')]
#[ORM\Index(name: 'status_lat_lng_last_update_index', columns: ['status', 'lat', 'lng', 'last_update_pozition'])]
#[ORM\Entity(repositoryClass: \AdminBundle\Repository\DriverRepository::class)]
#[ORM\HasLifecycleCallbacks]
class Driver extends BaseEntity
{
const STATUS_ACTIVE = 1;
const STATUS_SUSPENDED = 2;
const STATUS_NOT_CONFIRMED = 3;
const STATUS_EMERGENCY = 4;
const STATUS_ON_HOLIDAY = 5;
const SIMPLE_STATUS_AVAILABLE = 1;
const SIMPLE_STATUS_BUSY = 2;
const SIMPLE_STATUS_END_OF_SHIFT = 3;
const OFF_DAY_MONDAY = 'Monday';
const OFF_DAY_TUESDAY = 'Tuesday';
const OFF_DAY_WEDNESDAY = 'Wednesday';
const OFF_DAY_THURSDAY = 'Thursday';
const OFF_DAY_FRIDAY = 'Friday';
const OFF_DAY_SATURDAY = 'Saturday';
const OFF_DAY_SUNDAY = 'Sunday';
// Positive reputation points
const REPUTATION_POINTS_NONE = 0;
const REPUTATION_POINTS_LOGGED_IN = 1;
const REPUTATION_POINTS_AUTOASSIGN_BOOKING = 3;
const REPUTATION_POINTS_DRIVER_LOGGED_UNDER_5_HOURS = 4;
const REPUTATION_POINTS_DISPATCH_ACCEPT = 5;
const REPUTATION_POINTS_DRIVER_LOGGED_OVER_5_HOURS = 6;
const REPUTATION_POINTS_DISPATCH_ACCEPT_OVER_12_HOURS = 3;
const REPUTATION_POINTS_DISPATCH_ACCEPT_UNDER_12_HOURS = 4;
const REPUTATION_POINTS_POSITIVE_REVIEW = 5;
const REPUTATION_POINTS_ASAP_CONFIRMED = 6;
const REPUTATION_POINTS_DISPATCH_ACCEPT_WHILE_IN_QUEUE = 6;
const REPUTATION_POINTS_DISPATCHED_NEARBY_WHILE_IN_QUEUE = 6;
const REPUTATION_POINTS_BOOKING_MANUALLY_DISPATCH = 10;
const REPUTATION_POINTS_BOOKING_COMPLETED_THREE = 10;
const REPUTATION_POINTS_BOOKING_ACCEPTED_IN_WEEKEND = 10;
const REPUTATION_POINTS_BOOKING_COMPLETED = 20;
const REPUTATION_POINTS_BOOKING_PACKAGE_REQUEST_CONFIRMED_12_HOURS = 10;
const REPUTATION_POINTS_BOOKING_PACKAGE_REQUEST_CONFIRMED_24_HOURS = 6;
const REPUTATION_POINTS_LINKED_BOOKING_REQUEST_CONFIRMED = 9;
const REPUTATION_POINTS_BOOKING_REQUEST_CONFIRMED_24_HOURS = 3;
// Negative reputation points
const REPUTATION_POINTS_NEGATIVE_REVIEW = -2;
const REPUTATION_POINTS_LAST_LOGIN_UNDER_3_DAYS = -3;
const REPUTATION_POINTS_ASAP_REJECTED = -7;
const REPUTATION_POINTS_BOOKING_REJECTED_WHILE_IN_QUEUE = -8;
const REPUTATION_POINTS_LAST_LOGIN_OVER_3_DAYS = -9;
const REPUTATION_POINTS_BOOKING_REJECTED = -10;
const REPUTATION_POINTS_BOOKING_DEALLOCATED_ON_DEMAND = -10;
const REPUTATION_POINTS_NO_BOOKING_ACCEPTED_IN_WEEKEND = -10;
const REPUTATION_POINTS_AUTOSUSPENDED = -20;
const REPUTATION_POINTS_LINKED_BOOKING_REQUEST_DEALLOCATED_ON_DEMAND = -9;
const REPUTATION_POINTS_BOOKING_REQUEST_DEALLOCATED_ON_DEMAND_12_HOURS = -10;
const REPUTATION_POINTS_BOOKING_REQUEST_DEALLOCATED_ON_DEMAND_24_HOURS = -4;
const REPUTATION_POINTS_BOOKING_PACKAGE_REQUEST_DEALLOCATED_ON_DEMAND_12_HOURS = -10;
const REPUTATION_POINTS_BOOKING_PACKAGE_REQUEST_DEALLOCATED_ON_DEMAND_24_HOURS = -8;
const ACTIVITY_REPUTATION_PERCENTAGE = 70;
const INTERNAL_REPUTATION_PERCENTAGE = 30;
public static $statusTypes = [
self::STATUS_ACTIVE => 'Active',
self::STATUS_SUSPENDED => 'Suspended',
self::STATUS_NOT_CONFIRMED => 'Not confirmed',
self::STATUS_ON_HOLIDAY => 'On Holiday',
];
public static $simpleStatusTypes = [
self::SIMPLE_STATUS_AVAILABLE => 'Available',
self::SIMPLE_STATUS_BUSY => 'On a Break',
self::STATUS_EMERGENCY => 'Emergency / Flag Down',
self::SIMPLE_STATUS_END_OF_SHIFT => 'End of Shift / Logout',
];
public static $offDaysTypes = [
self::OFF_DAY_MONDAY => 'Monday',
self::OFF_DAY_TUESDAY => 'Tuesday',
self::OFF_DAY_WEDNESDAY => 'Wednesday',
self::OFF_DAY_THURSDAY => 'Thursday',
self::OFF_DAY_FRIDAY => 'Friday',
self::OFF_DAY_SATURDAY => 'Saturday',
self::OFF_DAY_SUNDAY => 'Sunday',
];
const DRIVER_FILE_FOLDER = 'upload/driver/';
const PROFILE_PICTURE_SETTER = 'setPicture';
const PROOF_OF_RIGHT_TO_WORK_SETTER = 'setProofOfRightToWork';
const HACK_LICENSE_FILE_SETTER = 'setHackLicenseFile';
const DRIVER_LICENSE_PICTURE_SETTER = 'setDriverLicencePicture';
const PCO_LICENSE_FILE_SETTER = 'setPcoLicenseFile';
const NINO_FILE_SETTER = 'setNinoFile';
const DBS_CRIMINAL_CHECK_FILE_SETTER = 'setDbsCriminalCheckFile';
const DRIVER_AGREEMENT_FILE_SETTER = 'setDriverAgreementFile';
const OTHER_DOCUMENT_SETTER = 'setOtherDocument';
const REFERRAL_CODE_PREFIX = 'TW20';
/**
* @var integer
*/
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
protected $id;
/**
* @var string
*/
#[ORM\Column(name: 'internal_name', type: 'string', length: 64)]
protected $internalName;
/**
* @var string
*/
#[ORM\Column(name: 'license', type: 'string', length: 64)]
protected $license;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'license_expire_date', type: 'date')]
protected $licenseExpireDate;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'license_issue_date', type: 'date')]
protected $licenseIssueDate;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'public_carriage_office_expiry_date', type: 'date', nullable: true)]
protected $publicCarriageOfficeExpiryDate;
/**
* @var string
*/
#[ORM\Column(name: 'public_carriage_office_licence_number', type: 'string', length: 255, nullable: true)]
protected $publicCarriageOfficeLicenceNumber;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'hack_license_expiration_date', type: 'date', nullable: true)]
protected $hackLicenseExpirationDate;
/**
* @var string
*/
#[ORM\Column(name: 'hack_license_number', type: 'string', length: 255, nullable: true)]
protected $hackLicenseNumber;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'registration_date', type: 'date')]
protected $registrationDate;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'end_date', type: 'date', nullable: true)]
protected $endDate;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'updated', type: 'datetime')]
protected $updated;
/**
* @var string
*/
#[ORM\Column(name: 'phone', type: 'string', length: 20)]
protected $phone;
/**
* @var string
*/
#[ORM\Column(name: 'mobile_phone', type: 'string', length: 20, nullable: true)]
protected $mobilePhone;
/**
* @var integer
*/
#[ORM\Column(name: 'status', type: 'integer')]
protected $status;
/**
* @var integer
*/
#[ORM\Column(name: 'start_interval', type: 'integer', nullable: true)]
protected $startInterval;
/**
* @var boolean
*/
#[ORM\Column(name: 'selected_start_interval', type: 'boolean')]
protected $selectedStartInterval = false;
/**
* @var integer
*/
#[ORM\Column(name: 'simple_status', type: 'integer')]
protected $simpleStatus;
/**
* @var string
*/
#[ORM\Column(name: 'house_street_number', type: 'string', length: 255, nullable: true)]
protected $houseStreetNumber;
/**
* @var string
*/
#[ORM\Column(name: 'home_address_1', type: 'string', length: 255, nullable: true)]
protected $homeAddress1;
/**
* @var string
*/
#[ORM\Column(name: 'home_address_2', type: 'string', length: 255, nullable: true)]
protected $homeAddress2;
/**
* @var string
*/
#[ORM\Column(name: 'home_address_city', type: 'string', length: 255, nullable: true)]
protected $homeAddressCity;
/**
* @var string
*/
#[ORM\Column(name: 'home_address_postcode', type: 'string', length: 255, nullable: true)]
protected $homeAddressPostcode;
/**
* @var float
*/
#[ORM\Column(name: 'home_address_lat', type: 'float', precision: 10, scale: 6, nullable: true)]
protected $homeAddressLat;
/**
* @var float
*/
#[ORM\Column(name: 'home_address_lng', type: 'float', precision: 10, scale: 6, nullable: true)]
protected $homeAddressLng;
/**
* @var string
*/
#[ORM\Column(name: 'home_address_country', type: 'string', length: 255, nullable: true)]
protected $homeAddressCountry;
/**
* @var string
*/
#[ORM\Column(name: 'description', type: 'text', nullable: true)]
protected $description;
/**
* @var string
*/
#[ORM\Column(name: 'last_update_pozition', type: 'datetime', nullable: true)]
private $lastUpdatePozition;
/**
* @var string
*/
#[ORM\Column(name: 'lat', type: 'float', precision: 10, scale: 6, nullable: true)]
private $lat;
/**
* @var string
*/
#[ORM\Column(name: 'lng', type: 'float', precision: 10, scale: 6, nullable: true)]
private $lng;
/**
* @var string
*/
#[ORM\Column(name: 'picture', type: 'string', length: 255, nullable: true)]
protected $picture;
/**
* @var string
*/
#[ORM\Column(name: 'pco_license_file', type: 'string', length: 255, nullable: true)]
protected $pcoLicenseFile;
/**
* @var string
*/
#[ORM\Column(name: 'hack_license_file', type: 'string', length: 255, nullable: true)]
protected $hackLicenseFile;
/**
* @var string
*/
#[ORM\Column(name: 'proof_of_right_to_work', type: 'string', length: 255, nullable: true)]
protected $proofOfRightToWork;
/**
* @var string
*/
#[ORM\Column(name: 'nino_file', type: 'string', length: 255, nullable: true)]
protected $ninoFile;
/**
* @var string
*/
#[ORM\Column(name: 'dbs_criminal_check_file', type: 'string', length: 255, nullable: true)]
protected $dbsCriminalCheckFile;
/**
* @var string
*/
#[ORM\Column(name: 'driver_agreement_file', type: 'string', length: 255, nullable: true)]
protected $driverAgreementFile;
/**
* @var string
*/
#[ORM\Column(name: 'other_document', type: 'string', length: 255, nullable: true)]
protected $otherDocument;
/**
* @var string
*/
#[ORM\Column(name: 'driver_licence_picture', type: 'string', length: 255, nullable: true)]
protected $driverLicencePicture;
/**
* @var string
*/
#[ORM\Column(name: 'nationality', type: 'string', length: 255, nullable: true)]
protected $nationality;
/**
* @var string
*/
#[ORM\Column(name: 'national_insurance_number', type: 'string', length: 255, nullable: true)]
protected $nationalInsuranceNumber;
/**
* @var string
*/
#[ORM\Column(name: 'social_security_number', type: 'string', length: 255, nullable: true)]
protected $socialSecurityNumber;
/**
* @var string
*/
#[ORM\Column(name: 'bank_society', type: 'string', length: 255, nullable: true)]
protected $bankSociety;
/**
* @var string
*/
#[ORM\Column(name: 'bank_sort_code', type: 'string', length: 255, nullable: true)]
protected $bankSortCode;
/**
* @var boolean
*/
#[ORM\Column(name: 'all_day_shift', type: 'boolean', nullable: true)]
protected $allDayShift = false;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'day_time_shift_start', type: 'time', nullable: true)]
protected $dayTimeShiftStart;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'day_time_shift_end', type: 'time', nullable: true)]
protected $dayTimeShiftEnd;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'night_time_shift_start', type: 'time', nullable: true)]
protected $nightTimeShiftStart;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'night_time_shift_end', type: 'time', nullable: true)]
protected $nightTimeShiftEnd;
/**
* @var string
*/
#[ORM\Column(name: 'departure_location', type: 'string', length: 255, nullable: true)]
protected $departureLocation;
/**
* @var float
*/
#[ORM\Column(name: 'departure_location_lat', type: 'float', precision: 10, scale: 6, nullable: true)]
protected $departureLocationLat;
/**
* @var float
*/
#[ORM\Column(name: 'departure_location_lng', type: 'float', precision: 10, scale: 6, nullable: true)]
protected $departureLocationLng;
/**
* @var string
*/
#[ORM\Column(name: 'favorite_airport', type: 'string', length: 255, nullable: true)]
protected $favoriteAirport;
/**
* @var float
*/
#[ORM\Column(name: 'favorite_airport_lat', type: 'float', precision: 10, scale: 6, nullable: true)]
protected $favoriteAirportLat;
/**
* @var float
*/
#[ORM\Column(name: 'favorite_airport_lng', type: 'float', precision: 10, scale: 6, nullable: true)]
protected $favoriteAirportLng;
/**
* @var string
*/
#[ORM\Column(name: 'bank_account_number', type: 'string', length: 255, nullable: true)]
protected $bankAccountNumber;
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
#[ORM\OneToOne(targetEntity: \User::class, inversedBy: 'driver', cascade: ['all'])]
protected $user;
#[ORM\JoinColumn(name: 'car_id', referencedColumnName: 'id', unique: true, nullable: true)]
#[ORM\ManyToOne(targetEntity: \Car::class, inversedBy: 'drivers')]
protected $car;
#[ORM\OneToMany(targetEntity: \Booking::class, mappedBy: 'driver')]
private $bookings;
#[ORM\OneToMany(targetEntity: \BookingRequest::class, mappedBy: 'driver')]
private $bookings_request;
/**
* @var ArrayCollection
*/
#[ORM\OneToMany(targetEntity: \BroadcastedDriver::class, mappedBy: 'driver', cascade: ['persist', 'remove'], orphanRemoval: true)]
private $broadcastedDrivers;
/**
* @var ArrayCollection
*/
#[ORM\OneToMany(targetEntity: \UnassignedBookingsDriverRequests::class, mappedBy: 'driver', cascade: ['persist', 'remove'], orphanRemoval: true)]
private $unassignedBookingsRequests;
/**
* @var ArrayCollection
*/
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\NotificationBookingUpdate::class, mappedBy: 'driver', cascade: ['persist', 'remove'], orphanRemoval: true)]
private $notificationBookingUpdates;
/**
* @var ArrayCollection
*/
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverHistoryCars::class, mappedBy: 'driver', cascade: ['persist'])]
private $historyCars;
/**
* @var Driver
*/
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverInvoices::class, mappedBy: 'driver', cascade: ['persist'])]
private $invoices;
/**
* @var double
*/
#[ORM\Column(name: 'commission_office_up_to500', type: 'decimal', scale: 2, nullable: true)]
protected $commissionOfficeUpTo500 = 0;
/**
* @var double
*/
#[ORM\Column(name: 'commission_office_up_to1000', type: 'decimal', scale: 2, nullable: true)]
protected $commissionOfficeUpTo1000 = 0;
/**
* @var double
*/
#[ORM\Column(name: 'commission_office_up_to1500', type: 'decimal', scale: 2, nullable: true)]
protected $commissionOfficeUpTo1500 = 0;
/**
* @var double
*/
#[ORM\Column(name: 'commission_office_over1500', type: 'decimal', scale: 2, nullable: true)]
protected $commissionOfficeOver1500 = 0;
/**
* @var array
*/
#[ORM\Column(name: 'off_days', type: 'array', nullable: true)]
protected $offDays;
/**
* @var ArrayCollection
*/
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverHistory::class, mappedBy: 'driver', cascade: ['persist'])]
protected $driverHistory;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'suspended_until_date', type: 'datetime', nullable: true)]
protected $suspendedUntilDate;
/**
* @var double
*/
#[ORM\Column(name: 'internal_reputation', type: 'decimal', scale: 2, nullable: false, options: ['default' => '5.0'])]
protected $internalReputation = 0;
/**
* @var double
*/
#[ORM\Column(name: 'activity_reputation', type: 'decimal', scale: 2, nullable: false)]
protected $activityReputation = 0;
/**
* @var integer
*/
#[ORM\Column(name: 'reputation_points', type: 'integer', nullable: false, options: ['default' => 10000])]
protected $reputationPoints = 10000;
/**
* @var integer
*/
#[ORM\Column(name: 'top_reputation_points', type: 'integer', nullable: false, options: ['default' => 10000])]
protected $topReputationPoints = 10000;
/**
* @var integer
*/
#[ORM\Column(name: 'new_linked_booking_count', type: 'integer', nullable: false, options: ['default' => 0])]
protected $newLinkedBookingCount = 0;
/**
* @var \DateTime
*/
#[ORM\Column(name: 'deactivated_until', type: 'datetime', nullable: true)]
protected $deactivatedUntil;
/**
* @var ArrayCollection
*/
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverTimeShifts::class, mappedBy: 'driver', cascade: ['remove'])]
protected $driverTimeShifts;
/**
* @var ArrayCollection
*/
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverHistoryQueue::class, mappedBy: 'driver', cascade: ['remove'])]
protected $driverHistoryQueues;
/**
* @var ArrayCollection
*/
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\DriverHistoryTimelogs::class, mappedBy: 'driver', cascade: ['remove'])]
protected $driverHistoryTimelogs;
#[ORM\OneToMany(targetEntity: \AdminBundle\Entity\Answer::class, mappedBy: 'driver', cascade: ['all'], orphanRemoval: true)]
private $answers;
private $pictureFile;
private $driverLicencePictureFile;
private $pcoLicenseFileFile;
private $proofOfRightToWorkFile;
private $hackLicenseFileFile;
private $ninoFileFile;
private $dbsCriminalCheckFileFile;
private $driverAgreementFileFile;
private $otherDocumentFile;
public function __construct()
{
$this->user = new User();
$this->updated = new \DateTime();
$this->bookings = new ArrayCollection();
$this->bookings_request = new ArrayCollection();
$this->broadcastedDrivers = new ArrayCollection();
$this->notificationBookingUpdates = new ArrayCollection();
$this->driverHistory = new ArrayCollection();
$this->driverTimeShifts = new ArrayCollection();
$this->driverHistoryQueues = new ArrayCollection();
$this->driverHistoryTimelogs = new ArrayCollection();
$this->answers = new ArrayCollection();
$this->dayTimeShiftStart = new \DateTime();
$this->dayTimeShiftStart->setTime(3, 0, 0);
$this->dayTimeShiftEnd = new \DateTime();
$this->dayTimeShiftEnd->setTime(20, 0, 0);
$this->nightTimeShiftStart = new \DateTime();
$this->nightTimeShiftStart->setTime(20, 0, 0);
$this->nightTimeShiftEnd = new \DateTime();
$this->nightTimeShiftEnd->setTime(3, 0, 0);
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*/
public function setId($id)
{
$this->id = $id;
}
/*
* ???
*/
public function getLastUpdatePozitionString()
{
if (!$this->lastUpdatePozition) {
return;
}
return $this->lastUpdatePozition->format('Y-m-d H:i:s');
}
/**
* @return \DateTime
*/
public function getLastUpdatePozition()
{
return $this->lastUpdatePozition;
}
/**
* @param \DateTime $lastUpdatePozition
* @return Driver
*/
public function setLastUpdatePozition($lastUpdatePozition): Driver
{
$this->lastUpdatePozition = $lastUpdatePozition;
return $this;
}
/**
* @return float
*/
public function getLat()
{
return $this->lat;
}
/**
* @param float $lat
* @return Driver
*/
public function setLat($lat): Driver
{
$this->lat = $lat;
return $this;
}
/**
* @return float
*/
public function getLng()
{
return $this->lng;
}
/**
* @param float $lng
* @return Driver
*/
public function setLng($lng): Driver
{
$this->lng = $lng;
return $this;
}
/**
* @return string
*/
public function getInternalName()
{
return $this->internalName;
}
/**
* @param string $internalName
*/
public function setInternalName($internalName)
{
$this->internalName = $internalName;
}
/**
* @return int
*/
public function getStartInterval()
{
return $this->startInterval;
}
public function setStartInterval($startInterval)
{
$this->startInterval = $startInterval;
}
/**
* @return string
*/
public function getLicense()
{
return $this->license;
}
/**
* @param string $license
*/
public function setLicense($license)
{
$this->license = $license;
}
/**
* @return \DateTime
*/
public function getLicenseExpireDate()
{
return $this->licenseExpireDate;
}
/**
* @param \DateTime $licenseExpireDate
*/
public function setLicenseExpireDate($licenseExpireDate)
{
$this->licenseExpireDate = $licenseExpireDate;
}
/**
* @return \DateTime
*/
public function getLicenseIssueDate()
{
return $this->licenseIssueDate;
}
/**
* @param \DateTime $licenseIssueDate
*/
public function setLicenseIssueDate($licenseIssueDate)
{
$this->licenseIssueDate = $licenseIssueDate;
}
/**
* @return bool
*/
public function isSelectedStartInterval()
{
return $this->selectedStartInterval;
}
/**
* @param bool $selectedStartInterval
*/
public function setSelectedStartInterval($selectedStartInterval)
{
$this->selectedStartInterval = $selectedStartInterval;
}
/**
* @return \DateTime
*/
public function getPublicCarriageOfficeExpiryDate()
{
return $this->publicCarriageOfficeExpiryDate;
}
/**
* @param \DateTime $publicCarriageOfficeExpiryDate
*/
public function setPublicCarriageOfficeExpiryDate($publicCarriageOfficeExpiryDate)
{
$this->publicCarriageOfficeExpiryDate = $publicCarriageOfficeExpiryDate;
}
/**
* @return string
*/
public function getPublicCarriageOfficeLicenceNumber()
{
return $this->publicCarriageOfficeLicenceNumber;
}
/**
* @param string $publicCarriageOfficeLicenceNumber
*/
public function setPublicCarriageOfficeLicenceNumber($publicCarriageOfficeLicenceNumber)
{
$this->publicCarriageOfficeLicenceNumber = $publicCarriageOfficeLicenceNumber;
}
/**
* @return string
*/
public function getDepartureLocation()
{
return $this->departureLocation;
}
/**
* @param string $departureLocation
*/
public function setDepartureLocation($departureLocation)
{
$this->departureLocation = $departureLocation;
}
/**
* @return string
*/
public function getFavoriteAirport()
{
return $this->favoriteAirport;
}
/**
* @param string $favoriteAirport
*/
public function setFavoriteAirport($favoriteAirport)
{
$this->favoriteAirport = $favoriteAirport;
}
/**
* @return \DateTime
*/
public function getRegistrationDate()
{
return $this->registrationDate;
}
/**
* @param \DateTime $registrationDate
*/
public function setRegistrationDate($registrationDate)
{
$this->registrationDate = $registrationDate;
}
/**
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* @param string $phone
*/
public function setPhone($phone)
{
$this->phone = $phone;
}
/**
* @return string
*/
public function getMobilePhone()
{
return $this->mobilePhone;
}
/**
* @param string $mobilePhone
* @return Driver
*/
public function setMobilePhone($mobilePhone): Driver
{
$this->mobilePhone = $mobilePhone;
return $this;
}
/**
* @return mixed
*/
public function getStatus()
{
return $this->status;
}
/**
* @param mixed $status
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* @return mixed
*/
public function getSimpleStatus()
{
return $this->simpleStatus;
}
/**
* @param mixed $simpleStatus
* @return $this
*/
public function setSimpleStatus($simpleStatus)
{
$this->simpleStatus = $simpleStatus;
return $this;
}
/**
* @return string
*/
public function getHomeAddress1()
{
return $this->homeAddress1;
}
/**
* @param string $homeAddress1
*/
public function setHomeAddress1($homeAddress1)
{
$this->homeAddress1 = $homeAddress1;
}
/**
* @return string
*/
public function getHomeAddress2()
{
return $this->homeAddress2;
}
/**
* @param string $homeAddress2
*/
public function setHomeAddress2($homeAddress2)
{
$this->homeAddress2 = $homeAddress2;
}
/**
* @return string
*/
public function getHomeAddressCity()
{
return $this->homeAddressCity;
}
/**
* @param string $homeAddressCity
*/
public function setHomeAddressCity($homeAddressCity)
{
$this->homeAddressCity = $homeAddressCity;
}
/**
* @return string
*/
public function getHomeAddressPostcode()
{
return $this->homeAddressPostcode;
}
/**
* @param string $homeAddressPostcode
*/
public function setHomeAddressPostcode($homeAddressPostcode)
{
$this->homeAddressPostcode = $homeAddressPostcode;
}
/**
* @return string
*/
public function getHomeAddressCountry()
{
return $this->homeAddressCountry;
}
/**
* @param string $homeAddressCountry
*/
public function setHomeAddressCountry($homeAddressCountry)
{
$this->homeAddressCountry = $homeAddressCountry;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* @param UploadedFile $picture
*/
public function setPictureFile(UploadedFile $pictureFile = null)
{
$this->pictureFile = $pictureFile;
}
/**
* @param UploadedFile $picture
*/
public function setDriverLicencePictureFile(UploadedFile $driverLicencePictureFile = null)
{
$this->driverLicencePictureFile = $driverLicencePictureFile;
}
/**
* @param UploadedFile $file
*/
public function setPcoLicenseFileFile(UploadedFile $driverPcoLicenseFileFile = null)
{
$this->pcoLicenseFileFile = $driverPcoLicenseFileFile;
}
/**
* @param UploadedFile $file
*/
public function setProofOfRightToWorkFile(UploadedFile $proofOfRightToWorkFile = null)
{
$this->proofOfRightToWorkFile = $proofOfRightToWorkFile;
}
/**
* @param UploadedFile $hackLicenseFileFile
*/
public function setHackLicenseFileFile(UploadedFile $hackLicenseFileFile = null)
{
$this->hackLicenseFileFile = $hackLicenseFileFile;
}
/**
* @param UploadedFile $file
*/
public function setNinoFileFile(UploadedFile $ninoFileFile = null)
{
$this->ninoFileFile = $ninoFileFile;
}
/**
* @param UploadedFile $file
*/
public function setDbsCriminalCheckFileFile(UploadedFile $dbsCriminalCheckFileFile = null)
{
$this->dbsCriminalCheckFileFile = $dbsCriminalCheckFileFile;
}
/**
* @param UploadedFile $file
*/
public function setDriverAgreementFileFile(UploadedFile $driverAgreementFileFile = null)
{
$this->driverAgreementFileFile = $driverAgreementFileFile;
}
/**
* @param UploadedFile $file
*/
public function setOtherDocumentFile(UploadedFile $otherDocumentFile = null)
{
$this->otherDocumentFile = $otherDocumentFile;
}
public function setUpdated($updated)
{
$this->updated = $updated;
}
public function getUpdated()
{
return $this->updated;
}
public function refreshUpdated()
{
$this->setUpdated(new \DateTime());
}
/**
* @return UploadedFile
*/
public function getPictureFile()
{
return $this->pictureFile;
}
/**
* @return UploadedFile
*/
public function getDriverLicencePictureFile()
{
return $this->driverLicencePictureFile;
}
/**
* @return UploadedFile
*/
public function getPcoLicenseFileFile()
{
return $this->pcoLicenseFileFile;
}
/**
* @return UploadedFile
*/
public function getProofOfRightToWorkFile()
{
return $this->proofOfRightToWorkFile;
}
/**
* @return UploadedFile
*/
public function getHackLicenseFileFile()
{
return $this->hackLicenseFileFile;
}
/**
* @return UploadedFile
*/
public function getNinoFileFile()
{
return $this->ninoFileFile;
}
/**
* @return UploadedFile
*/
public function getDbsCriminalCheckFileFile()
{
return $this->dbsCriminalCheckFileFile;
}
/**
* @return UploadedFile
*/
public function getDriverAgreementFileFile()
{
return $this->driverAgreementFileFile;
}
/**
* @return UploadedFile
*/
public function getOtherDocumentFile()
{
return $this->otherDocumentFile;
}
public function getPicturePath()
{
if (!$this->picture) {
return;
}
return $this->getUploadFilePath() . $this->picture;
}
public function getDriverLicencePicturePath()
{
if (!$this->driverLicencePicture) {
return;
}
return $this->getUploadFilePath() . $this->driverLicencePicture;
}
public function getPcoLicenseFilePath()
{
if (!$this->pcoLicenseFile) {
return;
}
return $this->getUploadFilePath() . $this->pcoLicenseFile;
}
public function getProofOfRightToWorkFilePath()
{
if (!$this->proofOfRightToWork) {
return;
}
return $this->getUploadFilePath() . $this->proofOfRightToWork;
}
public function getNinoFilePath()
{
if (!$this->ninoFile) {
return;
}
return $this->getUploadFilePath() . $this->ninoFile;
}
public function getHackLicenseFilePath()
{
if (!$this->hackLicenseFile) {
return;
}
return $this->getUploadFilePath() . $this->hackLicenseFile;
}
public function getDbsCriminalCheckFilePath()
{
if (!$this->dbsCriminalCheckFile) {
return;
}
return $this->getUploadFilePath() . $this->dbsCriminalCheckFile;
}
public function getDriverAgreementFilePath()
{
if (!$this->driverAgreementFile) {
return;
}
return $this->getUploadFilePath() . $this->driverAgreementFile;
}
public function getOtherDocumentFilePath()
{
if (!$this->otherDocument) {
return;
}
return $this->getUploadFilePath() . $this->otherDocument;
}
public function getPicture()
{
return $this->picture;
}
public function getDriverLicencePicture()
{
return $this->driverLicencePicture;
}
/**
* @return array
*/
public function getOffDays()
{
return $this->offDays;
}
/**
* @param array $offDays
*/
public function setOffDays($offDays)
{
$this->offDays = $offDays;
}
/**
* @return float
*/
public function getHomeAddressLat()
{
return $this->homeAddressLat;
}
/**
* @param float $homeAddressLat
*/
public function setHomeAddressLat($homeAddressLat)
{
$this->homeAddressLat = $homeAddressLat;
}
/**
* @return float
*/
public function getHomeAddressLng()
{
return $this->homeAddressLng;
}
/**
* @param float $homeAddressLng
*/
public function setHomeAddressLng($homeAddressLng)
{
$this->homeAddressLng = $homeAddressLng;
}
/**
* @return float
*/
public function getDepartureLocationLat()
{
return $this->departureLocationLat;
}
/**
* @param float $departureLocationLat
*/
public function setDepartureLocationLat($departureLocationLat)
{
$this->departureLocationLat = $departureLocationLat;
}
/**
* @return float
*/
public function getDepartureLocationLng()
{
return $this->departureLocationLng;
}
/**
* @param float $departureLocationLng
*/
public function setDepartureLocationLng($departureLocationLng)
{
$this->departureLocationLng = $departureLocationLng;
}
/**
* @return float
*/
public function getFavoriteAirportLat()
{
return $this->favoriteAirportLat;
}
/**
* @param float $favoriteAirportLat
*/
public function setFavoriteAirportLat($favoriteAirportLat)
{
$this->favoriteAirportLat = $favoriteAirportLat;
}
/**
* @return mixed
*/
public function getFavoriteAirportLng()
{
return $this->favoriteAirportLng;
}
/**
* @param mixed $favoriteAirportLng
*/
public function setFavoriteAirportLng($favoriteAirportLng)
{
$this->favoriteAirportLng = $favoriteAirportLng;
}
/**
* @return bool
*/
public function isAllDayShift()
{
return $this->allDayShift;
}
/**
* @param bool $allDayShift
*/
public function setAllDayShift($allDayShift)
{
$this->allDayShift = $allDayShift;
}
public function getDayTimeShiftStartDateFormat()
{
$dayTimeShiftStart = new \DateTime();
$dayTimeShiftStart->setTime(
$this->dayTimeShiftStart->format('G'),
$this->dayTimeShiftStart->format('i'),
$this->dayTimeShiftStart->format('s')
);
return $dayTimeShiftStart;
}
public function getDayTimeShiftStart()
{
if (!$this->dayTimeShiftStart) {
return;
}
return $this->dayTimeShiftStart->format('H:i');
}
public function setDayTimeShiftStart($dayTimeShiftStart)
{
if (is_string($dayTimeShiftStart)) {
$timeArray = explode(':', $dayTimeShiftStart);
$dayTimeShiftStart = new \DateTime();
$dayTimeShiftStart->setTime($timeArray[0], $timeArray[1]);
}
if (!$this->dayTimeShiftStart) {
$this->dayTimeShiftStart = new \DateTime();
}
$date = clone $this->dayTimeShiftStart;
$date->setTime(
$dayTimeShiftStart->format('G'),
$dayTimeShiftStart->format('i'),
$dayTimeShiftStart->format('s')
);
$this->dayTimeShiftStart = $date;
}
public function getDayTimeShiftEndDateFormat()
{
$dayTimeShiftEnd = new \DateTime();
$dayTimeShiftEnd->setTime(
$this->dayTimeShiftEnd->format('G'),
$this->dayTimeShiftEnd->format('i'),
$this->dayTimeShiftEnd->format('s')
);
return $dayTimeShiftEnd;
}
public function getDayTimeShiftEnd()
{
if (!$this->dayTimeShiftEnd) {
return;
}
return $this->dayTimeShiftEnd->format('H:i');
}
public function setDayTimeShiftEnd($dayTimeShiftEnd)
{
if (is_string($dayTimeShiftEnd)) {
$timeArray = explode(':', $dayTimeShiftEnd);
$dayTimeShiftEnd = new \DateTime();
$dayTimeShiftEnd->setTime($timeArray[0], $timeArray[1]);
}
if (!$this->dayTimeShiftEnd) {
$this->dayTimeShiftEnd = new \DateTime();
}
$date = clone $this->dayTimeShiftEnd;
$date->setTime(
$dayTimeShiftEnd->format('G'),
$dayTimeShiftEnd->format('i'),
$dayTimeShiftEnd->format('s')
);
$this->dayTimeShiftEnd = $date;
}
public function getNightTimeShiftStartDateFormat()
{
$nightTimeShiftStart = new \DateTime();
$nightTimeShiftStart->setTime(
$this->nightTimeShiftStart->format('G'),
$this->nightTimeShiftStart->format('i'),
$this->nightTimeShiftStart->format('s')
);
return $nightTimeShiftStart;
}
public function getNightTimeShiftStart()
{
if (!$this->nightTimeShiftStart) {
return;
}
return $this->nightTimeShiftStart->format('H:i');
}
public function setNightTimeShiftStart($nightTimeShiftStart)
{
if (is_string($nightTimeShiftStart)) {
$timeArray = explode(':', $nightTimeShiftStart);
$nightTimeShiftStart = new \DateTime();
$nightTimeShiftStart->setTime($timeArray[0], $timeArray[1]);
}
if (!$this->nightTimeShiftStart) {
$this->nightTimeShiftStart = new \DateTime();
}
$date = clone $this->nightTimeShiftStart;
$date->setTime(
$nightTimeShiftStart->format('G'),
$nightTimeShiftStart->format('i'),
$nightTimeShiftStart->format('s')
);
$this->nightTimeShiftStart = $date;
}
public function getNightTimeShiftEndDateFormat()
{
$nightTimeShiftEnd = new \DateTime();
$nightTimeShiftEnd->setTime(
$this->nightTimeShiftEnd->format('G'),
$this->nightTimeShiftEnd->format('i'),
$this->nightTimeShiftEnd->format('s')
);
return $nightTimeShiftEnd;
}
public function getNightTimeShiftEnd()
{
if (!$this->nightTimeShiftEnd) {
return;
}
return $this->nightTimeShiftEnd->format('H:i');
}
public function setNightTimeShiftEnd($nightTimeShiftEnd)
{
if (is_string($nightTimeShiftEnd)) {
$timeArray = explode(':', $nightTimeShiftEnd);
$nightTimeShiftEnd = new \DateTime();
$nightTimeShiftEnd->setTime($timeArray[0], $timeArray[1]);
}
if (!$this->nightTimeShiftEnd) {
$this->nightTimeShiftEnd = new \DateTime();
}
$date = clone $this->dayTimeShiftEnd;
$date->setTime(
$nightTimeShiftEnd->format('G'),
$nightTimeShiftEnd->format('i'),
$nightTimeShiftEnd->format('s')
);
$this->nightTimeShiftEnd = $date;
}
public function uploadPicture()
{
if (null === $this->getPictureFile()) {
return;
}
$this->removePictureFile();
$filename = sha1(uniqid(mt_rand(), true));
$this->picture = $filename . '.' . $this->getPictureFile()->guessExtension();
header("Content-type: image/jpeg");
$image = new \Eventviva\ImageResize($this->getPictureFile());
$image->crop(413, 531, ImageResize::CROPCENTER);
$image->save($this->getUploadFilePath() . '/' . $this->picture);
// $resiziedPicture->move(
// $this->getUploadFilePath(),
// $this->picture
// );
}
public function uploadDriverLicencePicture()
{
if (null === $this->getDriverLicencePictureFile()) {
return;
}
$this->removeDriverLicencePictureFile();
$filename = sha1(uniqid(mt_rand(), true));
$this->driverLicencePicture = $filename . '.' . $this->getDriverLicencePictureFile()->guessExtension();
$this->getDriverLicencePictureFile()->move(
$this->getUploadFilePath(),
$this->driverLicencePicture
);
$this->setDriverLicencePictureFile(null);
}
public function uploadPcoLicenseFile()
{
if (null === $this->getPcoLicenseFileFile()) {
return;
}
$this->removePcoLicenseFileFile();
$nDate = new \DateTime();
$filename = 'PCO_LICENSE_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
$this->pcoLicenseFile = $filename . '.' . $this->getPcoLicenseFileFile()->guessExtension();
$this->getPcoLicenseFileFile()->move(
$this->getUploadFilePath(),
$this->pcoLicenseFile
);
$this->setPcoLicenseFileFile(null);
}
public function uploadProofOfRightToWorkFile()
{
if (null === $this->getProofOfRightToWorkFile()) {
return;
}
$this->removeProofOfRightToWorkFile();
$nDate = new \DateTime();
$filename = 'PROOF_OF_RIGHT_TO_WORK_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
$this->proofOfRightToWork = $filename . '.' . $this->getProofOfRightToWorkFile()->guessExtension();
$this->getProofOfRightToWorkFile()->move(
$this->getUploadFilePath(),
$this->proofOfRightToWork
);
$this->setProofOfRightToWorkFile(null);
}
public function uploadNinoFile()
{
if (null === $this->getNinoFileFile()) {
return;
}
$this->removeNinoFileFile();
$nDate = new \DateTime();
$filename = 'NINO_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
$this->ninoFile = $filename . '.' . $this->getNinoFileFile()->guessExtension();
$this->getNinoFileFile()->move(
$this->getUploadFilePath(),
$this->ninoFile
);
$this->setNinoFileFile(null);
}
public function uploadHackLicenseFile()
{
if (null === $this->getHackLicenseFileFile()) {
return;
}
$this->removeHackLicenseFile();
$nDate = new \DateTime();
$filename = 'HACK_LICENSE_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
$this->hackLicenseFile = $filename . '.' . $this->getHackLicenseFileFile()->guessExtension();
$this->getHackLicenseFileFile()->move(
$this->getUploadFilePath(),
$this->hackLicenseFile
);
$this->setHackLicenseFileFile(null);
}
public function uploadDbsCriminalCheckFile()
{
if (null === $this->getDbsCriminalCheckFileFile()) {
return;
}
$this->removeDbsCriminalCheckFileFile();
$nDate = new \DateTime();
$filename = 'DBS_CRIMINAL_CHECK_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
$this->dbsCriminalCheckFile = $filename . '.' . $this->getDbsCriminalCheckFileFile()->guessExtension();
$this->getDbsCriminalCheckFileFile()->move(
$this->getUploadFilePath(),
$this->dbsCriminalCheckFile
);
$this->setDbsCriminalCheckFileFile(null);
}
public function uploadDriverAgreementFile()
{
if (null === $this->getDriverAgreementFileFile()) {
return;
}
$this->removeDriverAgreementFileFile();
$nDate = new \DateTime();
$filename = 'DRIVER_AGREEMENT_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
$this->driverAgreementFile = $filename . '.' . $this->getDriverAgreementFileFile()->guessExtension();
$this->getDriverAgreementFileFile()->move(
$this->getUploadFilePath(),
$this->driverAgreementFile
);
$this->setDriverAgreementFileFile(null);
}
public function uploadOtherDocumentFile()
{
if (null === $this->getOtherDocumentFile()) {
return;
}
$this->removeOtherDocumentFile();
$nDate = new \DateTime();
$filename = 'OTHER_DOCUMENT_' . str_replace(' ','_',trim($this->getUser()->getFirstname() . '' . $this->getUser()->getLastname())) . '_' . $nDate->format('Y-m-d');
$this->otherDocument = $filename . '.' . $this->getOtherDocumentFile()->guessExtension();
$this->getOtherDocumentFile()->move(
$this->getUploadFilePath(),
$this->otherDocument
);
$this->setOtherDocumentFile(null);
}
public function getUploadFilePath()
{
if (!is_dir(self::DRIVER_FILE_FOLDER . $this->id)) {
mkdir(self::DRIVER_FILE_FOLDER . $this->id, 0777, true);
}
return self::DRIVER_FILE_FOLDER . $this->id . '/';
}
#[ORM\PreUpdate]
#[ORM\PrePersist]
public function lifecycleFileUpload()
{
$this->uploadPicture();
$this->uploadProofOfRightToWorkFile();
$this->uploadHackLicenseFile();
$this->uploadDriverLicencePicture();
$this->uploadPcoLicenseFile();
$this->uploadDbsCriminalCheckFile();
$this->uploadNinoFile();
$this->uploadDriverAgreementFile();
$this->uploadOtherDocumentFile();
}
#[ORM\PrePersist]
#[ORM\PreUpdate]
public function updatedTimestamps()
{
$this->setUpdated(new \DateTime());
}
#[ORM\PostRemove]
public function removeUpload()
{
$this->removePictureFile();
$this->removeProofOfRightToWorkFile();
$this->removeHackLicenseFile();
$this->removeDriverLicencePictureFile();
$this->removePcoLicenseFileFile();
$this->removeNinoFileFile();
$this->removeDbsCriminalCheckFileFile();
$this->removeDriverAgreementFileFile();
$this->removeOtherDocumentFile();
}
public function removePictureFile()
{
if ($pictureFile = $this->getPicturePath()) {
@unlink($pictureFile);
}
}
public function removeDriverLicencePictureFile()
{
if ($driverLicencePictureFile = $this->getDriverLicencePicturePath()) {
@unlink($driverLicencePictureFile);
}
}
public function removePcoLicenseFileFile()
{
if ($pcoLicenseFileFile = $this->getPcoLicenseFilePath()) {
@unlink($pcoLicenseFileFile);
}
}
public function removeHackLicenseFile()
{
if ($hackLicenseFileFile = $this->getHackLicenseFilePath()) {
@unlink($hackLicenseFileFile);
}
}
public function removeProofOfRightToWorkFile()
{
if ($proofOfRightToWorkFile = $this->getProofOfRightToWorkFilePath()) {
@unlink($proofOfRightToWorkFile);
}
}
public function removeNinoFileFile()
{
if ($ninoFileFile = $this->getNinoFilePath()) {
@unlink($ninoFileFile);
}
}
public function removeDbsCriminalCheckFileFile()
{
if ($dbsCriminalCheckFileFile = $this->getDbsCriminalCheckFilePath()) {
@unlink($dbsCriminalCheckFileFile);
}
}
public function removeDriverAgreementFileFile()
{
if ($driverAgreementFileFile = $this->getDriverAgreementFilePath()) {
@unlink($driverAgreementFileFile);
}
}
public function removeOtherDocumentFile()
{
if ($otherDocumentFile = $this->getOtherDocumentFilePath()) {
@unlink($otherDocumentFile);
}
}
public function getUser()
{
return $this->user;
}
public function setUser(User $user)
{
$this->user = $user;
}
/**
* @return Car
*/
public function getCar()
{
return $this->car;
}
/**
* @param Car $car
*/
public function setCar(Car $car = null)
{
$this->car = $car;
}
/**
* @return ArrayCollection
*/
public function getBookings()
{
return $this->bookings;
}
/**
* @param Booking $bookings
*/
public function setBookings(Booking $bookings)
{
$this->bookings = $bookings;
}
/**
* @return ArrayCollection
*/
public function getBookingsRequest()
{
return $this->bookings_request;
}
/**
* @param BookingRequest $bookings_request
*/
public function setBookingsRequest(BookingRequest $bookings_request)
{
$this->bookings_request = $bookings_request;
}
/**
* @return ArrayCollection
*/
public function getBroadcastedDrivers()
{
return $this->broadcastedDrivers;
}
/**
* @param ArrayCollection $broadcastedDrivers
*/
public function setBroadcastedDrivers($broadcastedDrivers)
{
$this->broadcastedDrivers = $broadcastedDrivers;
}
/**
* @return ArrayCollection
*/
public function getUnassignedBookingsRequests()
{
return $this->unassignedBookingsRequests;
}
/**
* @param ArrayCollection $unassignedBookingsRequests
*/
public function setUnassignedBookingsRequests($unassignedBookingsRequests)
{
$this->unassignedBookingsRequests = $unassignedBookingsRequests;
}
/**
* @return ArrayCollection
*/
public function getNotificationBookingUpdates(): ArrayCollection
{
return $this->notificationBookingUpdates;
}
/**
* @param $notificationBookingUpdates
* @return Driver
*/
public function setNotificationBookingUpdates($notificationBookingUpdates): Driver
{
$this->notificationBookingUpdates = $notificationBookingUpdates;
return $this;
}
/**
* @param NotificationBookingUpdate $notificationBookingUpdate
* @return Driver
*/
public function addNotificationBookingUpdate(NotificationBookingUpdate $notificationBookingUpdate)
{
$this->notificationBookingUpdates->add($notificationBookingUpdate);
return $this;
}
//protected $activeVehicle;
//protected $currentDevice;
//protected $rackingEntityId";
public function __toString()
{
return $this->getId() ? (string) $this->getUser()->getEmail() : 'n\a';
}
/**
* @return Booking|null;
*/
public function getActiveBooking()
{
$criteria = Criteria::create()->where(Criteria::expr()->in('status', [
Booking::STATUS_ON_THE_WAY, Booking::STATUS_ARRIVED_AND_WAITING,
Booking::STATUS_PASSENGER_ON_BOARD, Booking::STATUS_ABOUT_TO_DROP,
]));
return $this->getBookings()->matching($criteria)->first();
}
public function getMarkerPicture()
{
$markersPicture = [
self::SIMPLE_STATUS_AVAILABLE => 'status_1.png',
self::SIMPLE_STATUS_BUSY => 'status_2.png',
self::SIMPLE_STATUS_END_OF_SHIFT => 'status_4.png',
self::STATUS_EMERGENCY => 'status_3.png',
];
if (!empty($this->getActiveBooking())) {
return 'status_' . $this->getActiveBooking()->getStatus() . '.png';
}
return $markersPicture[$this->getSimpleStatus()];
}
/**
* Add invoice
*
* @param \AdminBundle\Entity\DriverInvoices $invoice
*
* @return Driver
*/
public function addInvoice(\AdminBundle\Entity\DriverInvoices $invoice)
{
$this->invoices[] = $invoice;
return $this;
}
/**
* Remove invoice
*
* @param \AdminBundle\Entity\DriverInvoices $invoice
*/
public function removeInvoice(\AdminBundle\Entity\DriverInvoices $invoice)
{
$this->invoices->removeElement($invoice);
}
/**
* Get invoices
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getInvoices()
{
return $this->invoices;
}
/**
* Set picture
*
* @param string $picture
*
* @return Driver
*/
public function setPicture($picture)
{
$this->picture = $picture;
return $this;
}
/**
* Set driverLicencePicture
*
* @param string $driverLicencePicture
*
* @return Driver
*/
public function setDriverLicencePicture($driverLicencePicture)
{
$this->driverLicencePicture = $driverLicencePicture;
return $this;
}
/**
* Add booking
*
* @param \AdminBundle\Entity\Booking $booking
*
* @return Driver
*/
public function addBooking(\AdminBundle\Entity\Booking $booking)
{
$this->bookings[] = $booking;
return $this;
}
/**
* Remove booking
*
* @param \AdminBundle\Entity\Booking $booking
*/
public function removeBooking(\AdminBundle\Entity\Booking $booking)
{
$this->bookings->removeElement($booking);
}
/**
* Add booking request
*
* @param \AdminBundle\Entity\BookingRequest $booking_request
*
* @return Driver
*/
public function addBookingRequest(\AdminBundle\Entity\BookingRequest $booking_request)
{
$this->bookings_request[] = $booking_request;
return $this;
}
/**
* Remove booking request
*
* @param \AdminBundle\Entity\BookingRequest $booking_request
*/
public function removeBookingRequest(\AdminBundle\Entity\BookingRequest $booking_request)
{
$this->bookings_request->removeElement($booking_request);
}
/**
* Add broadcastedDriver
*
* @param \AdminBundle\Entity\BroadcastedDriver $broadcastedDriver
*
* @return Driver
*/
public function addBroadcastedDriver(\AdminBundle\Entity\BroadcastedDriver $broadcastedDriver)
{
$this->broadcastedDrivers[] = $broadcastedDriver;
return $this;
}
/**
* Remove broadcastedDriver
*
* @param \AdminBundle\Entity\BroadcastedDriver $broadcastedDriver
*/
public function removeBroadcastedDriver(\AdminBundle\Entity\BroadcastedDriver $broadcastedDriver)
{
$this->broadcastedDrivers->removeElement($broadcastedDriver);
}
/**
* Remove notificationBookingUpdate
*
* @param \AdminBundle\Entity\NotificationBookingUpdate $notificationBookingUpdate
*/
public function removeNotificationBookingUpdate(\AdminBundle\Entity\NotificationBookingUpdate $notificationBookingUpdate)
{
$this->notificationBookingUpdates->removeElement($notificationBookingUpdate);
}
/**
* Add historyCar
*
* @param \AdminBundle\Entity\DriverHistoryCars $historyCar
*
* @return Driver
*/
public function addHistoryCar(\AdminBundle\Entity\DriverHistoryCars $historyCar)
{
$this->historyCars[] = $historyCar;
return $this;
}
/**
* Remove historyCar
*
* @param \AdminBundle\Entity\DriverHistoryCars $historyCar
*/
public function removeHistoryCar(\AdminBundle\Entity\DriverHistoryCars $historyCar)
{
$this->historyCars->removeElement($historyCar);
}
/**
* Get historyCars
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getHistoryCars()
{
return $this->historyCars;
}
/**
* @return \DateTime
*/
public function getEndDate()
{
return $this->endDate;
}
/**
* @param \DateTime $endDate
*/
public function setEndDate($endDate)
{
$this->endDate = $endDate;
}
/**
* @return string
*/
public function getNationality()
{
return $this->nationality;
}
/**
* @param string $nationality
*/
public function setNationality($nationality)
{
$this->nationality = $nationality;
}
/**
* @return string
*/
public function getNationalInsuranceNumber()
{
return $this->nationalInsuranceNumber;
}
/**
* @param string $nationalInsuranceNumber
*/
public function setNationalInsuranceNumber($nationalInsuranceNumber)
{
$this->nationalInsuranceNumber = $nationalInsuranceNumber;
}
/**
* @return string
*/
public function getBankSociety()
{
return $this->bankSociety;
}
/**
* @param string $bankSociety
*/
public function setBankSociety($bankSociety)
{
$this->bankSociety = $bankSociety;
}
/**
* @return string
*/
public function getBankSortCode()
{
return $this->bankSortCode;
}
/**
* @param string $bankSortCode
*/
public function setBankSortCode($bankSortCode)
{
$this->bankSortCode = $bankSortCode;
}
/**
* @return string
*/
public function getBankAccountNumber()
{
return $this->bankAccountNumber;
}
/**
* @param string $bankAccountNumber
*/
public function setBankAccountNumber($bankAccountNumber)
{
$this->bankAccountNumber = $bankAccountNumber;
}
/**
* @return string
*/
public function getPcoLicenseFile()
{
return $this->pcoLicenseFile;
}
/**
* @param string $pcoLicenseFile
*/
public function setPcoLicenseFile($pcoLicenseFile)
{
$this->pcoLicenseFile = $pcoLicenseFile;
}
/**
* @return \DateTime
*/
public function getHackLicenseExpirationDate()
{
return $this->hackLicenseExpirationDate;
}
/**
* @param \DateTime $hackLicenseExpirationDate
*/
public function setHackLicenseExpirationDate($hackLicenseExpirationDate)
{
$this->hackLicenseExpirationDate = $hackLicenseExpirationDate;
}
/**
* @return string
*/
public function getHackLicenseNumber()
{
return $this->hackLicenseNumber;
}
/**
* @param string $hackLicenseNumber
*/
public function setHackLicenseNumber($hackLicenseNumber)
{
$this->hackLicenseNumber = $hackLicenseNumber;
}
/**
* @return string
*/
public function getProofOfRightToWork()
{
return $this->proofOfRightToWork;
}
/**
* @param string $proofOfRightToWork
*/
public function setProofOfRightToWork($proofOfRightToWork)
{
$this->proofOfRightToWork = $proofOfRightToWork;
}
/**
* @return string
*/
public function getSocialSecurityNumber()
{
return $this->socialSecurityNumber;
}
/**
* @param string $socialSecurityNumber
*/
public function setSocialSecurityNumber($socialSecurityNumber)
{
$this->socialSecurityNumber = $socialSecurityNumber;
}
/**
* @return string
*/
public function getHackLicenseFile()
{
return $this->hackLicenseFile;
}
/**
* @param string $hackLicenseFile
*/
public function setHackLicenseFile($hackLicenseFile)
{
$this->hackLicenseFile = $hackLicenseFile;
}
/**
* @return string
*/
public function getNinoFile()
{
return $this->ninoFile;
}
/**
* @param string $ninoFile
*/
public function setNinoFile($ninoFile)
{
$this->ninoFile = $ninoFile;
}
/**
* @return string
*/
public function getDbsCriminalCheckFile()
{
return $this->dbsCriminalCheckFile;
}
/**
* @param string $dbsCriminalCheckFile
*/
public function setDbsCriminalCheckFile($dbsCriminalCheckFile)
{
$this->dbsCriminalCheckFile = $dbsCriminalCheckFile;
}
/**
* @return string
*/
public function getDriverAgreementFile()
{
return $this->driverAgreementFile;
}
/**
* @param string $driverAgreementFile
*/
public function setDriverAgreementFile($driverAgreementFile)
{
$this->driverAgreementFile = $driverAgreementFile;
}
/**
* @return string
*/
public function getOtherDocument()
{
return $this->otherDocument;
}
/**
* @param string $otherDocument
*/
public function setOtherDocument($otherDocument)
{
$this->otherDocument = $otherDocument;
}
/**
* @return string
*/
public function getHouseStreetNumber()
{
return $this->houseStreetNumber;
}
/**
* @param string $houseStreetNumber
*/
public function setHouseStreetNumber($houseStreetNumber)
{
$this->houseStreetNumber = $houseStreetNumber;
}
/**
* @return float
*/
public function getCommissionOfficeUpTo500()
{
return $this->commissionOfficeUpTo500;
}
/**
* @param float $commissionOfficeUpTo500
*/
public function setCommissionOfficeUpTo500($commissionOfficeUpTo500)
{
$this->commissionOfficeUpTo500 = $commissionOfficeUpTo500;
}
/**
* @return float
*/
public function getCommissionOfficeUpTo1000()
{
return $this->commissionOfficeUpTo1000;
}
/**
* @param float $commissionOfficeUpTo1000
*/
public function setCommissionOfficeUpTo1000($commissionOfficeUpTo1000)
{
$this->commissionOfficeUpTo1000 = $commissionOfficeUpTo1000;
}
/**
* @return float
*/
public function getCommissionOfficeUpTo1500()
{
return $this->commissionOfficeUpTo1500;
}
/**
* @param float $commissionOfficeUpTo1500
*/
public function setCommissionOfficeUpTo1500($commissionOfficeUpTo1500)
{
$this->commissionOfficeUpTo1500 = $commissionOfficeUpTo1500;
}
/**
* @return float
*/
public function getCommissionOfficeOver1500()
{
return $this->commissionOfficeOver1500;
}
/**
* @param float $commissionOfficeOver1500
*/
public function setCommissionOfficeOver1500($commissionOfficeOver1500)
{
$this->commissionOfficeOver1500 = $commissionOfficeOver1500;
}
public function getStartLocation()
{
$departureLocation = null;
if ($this->getFavoriteAirportLat() && $this->getFavoriteAirportLng()) {
$departureLocation = [
'lat' => $this->getFavoriteAirportLat(),
'lng' => $this->getFavoriteAirportLng(),
];
}
if ($this->getDepartureLocationLat() && $this->getDepartureLocationLng()) {
$departureLocation = [
'lat' => $this->getDepartureLocationLat(),
'lng' => $this->getDepartureLocationLng(),
];
}
if ($this->getHomeAddressLat() && $this->getHomeAddressLng()) {
$departureLocation = [
'lat' => $this->getHomeAddressLat(),
'lng' => $this->getHomeAddressLng(),
];
}
return $departureLocation;
}
/**
* @return \DateTime
*/
public function getSuspendedUntilDate()
{
return $this->suspendedUntilDate;
}
/**
* @param \DateTime $suspendedUntilDate
*/
public function setSuspendedUntilDate($suspendedUntilDate)
{
$this->suspendedUntilDate = $suspendedUntilDate;
}
/**
* Add driverHistory
*
* @param DriverHistory $driverHistory
*
* @return Driver
*/
public function addDriverHistory(DriverHistory $driverHistory)
{
$this->driverHistory[] = $driverHistory;
return $this;
}
/**
* @param DriverHistory $driverHistory
*/
public function removeDriverHistory(DriverHistory $driverHistory)
{
$this->driverHistory->removeElement($driverHistory);
}
/**
* @return \Doctrine\Common\Collections\Collection
*/
public function getDriverHistory()
{
return $this->driverHistory;
}
/**
* @param float $internalReputation
*/
public function setInternalReputation($internalReputation)
{
$this->internalReputation = $internalReputation;
return $this;
}
/**
* @return float
*/
public function getInternalReputation()
{
return $this->internalReputation;
}
/**
* @param float $activityReputation
*/
public function setActivityReputation($activityReputation)
{
$this->activityReputation = $activityReputation;
return $this;
}
/**
* @return float
*/
public function getActivityReputation()
{
return $this->activityReputation;
}
/**
* @param integer $reputationPoints
*/
public function setReputationPoints($reputationPoints)
{
$this->reputationPoints = $reputationPoints;
return $this;
}
/**
* @return integer
*/
public function getReputationPoints()
{
return $this->reputationPoints;
}
/**
* @param integer $reputationPoints
*/
public function addReputationPoints($reputationPoints)
{
$this->reputationPoints = $this->getReputationPoints() + $reputationPoints;
return $this;
}
public function getOverallRating()
{
$activityReputation = $this->getActivityReputation();
$internalReputation = $this->getInternalReputation();
return number_format((self::ACTIVITY_REPUTATION_PERCENTAGE * $activityReputation) / 100 + (self::INTERNAL_REPUTATION_PERCENTAGE * $internalReputation) / 100, 2);
}
/**
* @param integer $topReputationPoints
*/
public function setTopReputationPoints($topReputationPoints)
{
$this->topReputationPoints = $topReputationPoints;
return $this;
}
/**
* @return integer
*/
public function getTopReputationPoints()
{
return $this->topReputationPoints;
}
/**
* @param integer $newLinkedBookingCount
*/
public function setNewLinkedBookingCount($newLinkedBookingCount)
{
$this->newLinkedBookingCount = $newLinkedBookingCount;
return $this;
}
/**
* @return integer
*/
public function getNewLinkedBookingCount()
{
return $this->newLinkedBookingCount;
}
public function setDeactivatedUntil($deactivatedUntil)
{
$this->deactivatedUntil = $deactivatedUntil;
}
public function getDeactivatedUntil()
{
return $this->deactivatedUntil;
}
public function isDeactivated()
{
return new \DateTime() < $this->getDeactivatedUntil();
}
/**
* Get the value of driverTimeShifts
*/
public function getDriverTimeShifts()
{
return $this->driverTimeShifts;
}
/**
* Set the value of driverTimeShifts
*
* @return Driver
*/
public function setDriverTimeShifts(ArrayCollection $driverTimeShifts)
{
$this->driverTimeShifts = $driverTimeShifts;
return $this;
}
/**
* @param DriverTimeShifts $driverTimeShifts
*
* @return Driver
*/
public function addDriverTimeShifts(DriverTimeShifts $driverTimeShifts)
{
$this->driverTimeShifts[] = $driverTimeShifts;
return $this;
}
/**
* @param DriverTimeShifts $driverTimeShifts
*
* @return Driver
*/
public function removeDriverTimeShifts(DriverTimeShifts $driverTimeShifts)
{
$this->driverTimeShifts->removeElement($driverTimeShifts);
return $this;
}
/**
* Get the value of driverTimeShifts on last 7 days
*/
public function getLatestDriverTimeShifts()
{
$shifts = [];
$startDate = new DateTime('-7 days');
foreach ($this->getDriverTimeShifts() as $shift) {
$shiftDate = $shift->getDate();
if ($shiftDate >= $startDate) {
$shifts[] = $shift;
}
}
return $shifts;
}
/**
* @param ArrayCollection $answers
*/
public function setAnswers(ArrayCollection $answers)
{
$this->answers = $answers;
return $this;
}
/**
* @return ArrayCollection
*/
public function getAnswers()
{
return $this->answers;
}
public function getQuestionnaires()
{
$questionnaires = [];
foreach ($this->getAnswers() as $answer) {
$question = $answer->getQuestion();
$questionnaire = $question->getQuestionnaire();
if (!isset($questionnaires[$questionnaire->getId()])) {
$questionnaires[$questionnaire->getId()] = [
'id' => $questionnaire->getId(),
'type' => $questionnaire->getType(),
'title' => $questionnaire->getTitle(),
'description' => $questionnaire->getDescription(),
'questions' => [],
];
}
$questionnaires[$questionnaire->getId()]['questions'][] = [
'name' => $question->getName(),
'value' => $answer->getValue(),
];
}
return $questionnaires;
}
/**
* Get the value of driverHistoryQueues
*/
public function getDriverHistoryQueues()
{
return $this->driverHistoryQueues;
}
/**
* Set the value of driverHistoryQueues
*
* @return Driver
*/
public function setDriverHistoryQueues(ArrayCollection $driverHistoryQueues)
{
$this->driverHistoryQueues = $driverHistoryQueues;
return $this;
}
/**
* @param DriverHistoryQueue $driverHistoryQueue
*
* @return Driver
*/
public function addDriverHistoryQueue(DriverHistoryQueue $driverHistoryQueue)
{
$this->driverHistoryQueues[] = $driverHistoryQueue;
return $this;
}
/**
* @param DriverHistoryQueue $driverHistoryQueue
*
* @return Driver
*/
public function removeDriverHistoryQueue(DriverHistoryQueue $driverHistoryQueue)
{
$this->driverHistoryQueues->removeElement($driverHistoryQueue);
return $this;
}
/**
* Get the value of completed queues on last 14 days
*/
public function getLatestCompletedQueues()
{
$completed = [];
$startDate = new DateTime('-14 days');
foreach ($this->getDriverHistoryQueues() as $queue) {
$queueDate = $queue->getCreatedAt();
if ($queueDate >= $startDate && $queue->getQueueTimeCompleted()) {
$completed[] = $queue;
}
}
return $completed;
}
/**
* Get the value of driverHistoryTimelogs
*/
public function getDriverHistoryTimelogs()
{
return $this->driverHistoryTimelogs;
}
/**
* Set the value of driverHistoryTimelogs
*
* @return Driver
*/
public function setDriverHistoryTimelogs(ArrayCollection $driverHistoryTimelogs)
{
$this->driverHistoryTimelogs = $driverHistoryTimelogs;
return $this;
}
/**
* @param DriverHistoryTimelogs $driverHistoryTimelogs
*
* @return Driver
*/
public function addDriverHistoryTimelog(DriverHistoryTimelogs $driverHistoryTimelog)
{
$this->driverHistoryTimelogs[] = $driverHistoryTimelog;
return $this;
}
/**
* @param DriverHistoryTimelogs $driverHistoryTimelogs
*
* @return Driver
*/
public function removeDriverHistoryTimelog(DriverHistoryTimelogs $driverHistoryTimelog)
{
$this->driverHistoryTimelogs->removeElement($driverHistoryTimelog);
return $this;
}
/**
* Get the value of completed queues on last 14 days
*/
public function getLatestDriverTimelogs()
{
$timelogs = [];
$startDate = new DateTime('-14 days');
foreach ($this->getDriverHistoryTimelogs() as $timelog) {
$timelogDate = $timelog->getDate();
if ($timelogDate >= $startDate) {
$dailyTotal = $timelog->getDailyTotal();
$time = '00:00';
if ($dailyTotal > 1) {
$hours = floor($dailyTotal / 60);
$minutes = ($dailyTotal % 60);
$time = sprintf('%02d:%02d', $hours, $minutes);
}
$timelogs[] = [
'date' => $timelogDate,
'time' => $time,
];
}
}
return $timelogs;
}
/**
* @return string
*/
public function getReferralCode()
{
return self::REFERRAL_CODE_PREFIX . $this->getInternalName();
}
/**
* Get userHistory
*
* @return Array
*/
public static function getUserHistory()
{
return [];
}
}