src/AdminBundle/Entity/DriverHistory.php line 13

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Entity;
  3. use DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * DriverHistory
  7. */
  8. #[ORM\Table(name: 'driver_history')]
  9. #[ORM\Entity(repositoryClass: \AdminBundle\Repository\DriverHistoryRepository::class)]
  10. class DriverHistory
  11. {
  12. const TYPE_DRIVER = 0;
  13. const TYPE_BOOKING = 1;
  14. const ACTION_LOGGEED_IN = 'Logged In';
  15. const VALUE_LOGGED_IN = 'Mobile App';
  16. const VALUE_AUTOASSIGN_BOOKING = "Autoassign 'Get Booking'";
  17. const VALUE_DISPATCH_ACCEPT = 'Dispatch Accept';
  18. const VALUE_DISPATCH_ACCEPT_WHILE_IN_QUEUE = 'Dispatch Accept while in queue';
  19. const VALUE_REJECTED = 'Rejected';
  20. const VALUE_REJECTED_WHILE_IN_QUEUE = 'Rejected while in queue';
  21. const VALUE_ON_THE_WAY = 'On the way';
  22. const VALUE_DEALLOCATED_ON_DMAND = 'Deallocated on demand';
  23. const VALUE_COMPLETED = 'Completed';
  24. const VALUE_COMPLETED_THREE = '3 Bookings completed in last 24 hours';
  25. const VALUE_SUSPENDED_BY_ADMIN = 'Suspended by Admin';
  26. const VALUE_ACTIVATED_BY_ADMIN = 'Activated by Admin';
  27. const VALUE_AUTOSUSPENDED_GET_BOOKING = 'Auto suspended from "Get booking" by System';
  28. const VALUE_REVIEW = 'Received review';
  29. const VALUE_ASAP_CONFIRMED = 'ASAP Booking Request confirmed';
  30. const VALUE_ASAP_REJECTED = 'ASAP Booking Request rejected';
  31. const VALUE_MANUALLY_DISPATCH = 'Booking manually dispatched (office assigned)';
  32. const VALUE_LOGGED_IN_BETWEEN = 'Logged In between 1 and 3 days';
  33. const VALUE_LOGGED_IN_AFTER_3_DAYS = 'Logged In after 3 days';
  34. const VALUE_BOOKING_ACCEPTED_IN_WEEKEND = 'Booking acceepted in weekend';
  35. const VALUE_NO_BOOKING_ACCEPTED_IN_WEEKEND = 'No booking was accepted during last weekend';
  36. const VALUE_DISPATCHED_NEARBY_WHILE_IN_QUEUE = 'Dispatched booking nearby while in queue. Driver automatically left queue';
  37. const VALUE_DRIVER_LOGGED_UNDER_5_HOURS = 'Driver stayed in app under 5 hours';
  38. const VALUE_DRIVER_LOGGED_OVER_5_HOURS = 'Driver stayed in app over 5 hours';
  39. const VALUE_DRIVER_MANUALLY_LEAVED_QUEUE = 'Driver manually leaved area queue';
  40. const VALUE_LINKED_BOOKING_REQUEST_DEALLOCATED_ON_DEMAND = 'Linked Booking Request Deallocated on demand';
  41. const VALUE_BOOKING_PACKAGE_REQUEST_DEALLOCATED_ON_DEMAND_12_HOURS = 'Booking Package Request Deallocated on demand in last 12 hours';
  42. const VALUE_BOOKING_PACKAGE_REQUEST_DEALLOCATED_ON_DEMAND_24_HOURS = 'Booking Package Request Deallocated on demand over 24 hours';
  43. const VALUE_BOOKING_REQUEST_DEALLOCATED_ON_DEMAND_12_HOURS = 'Booking Request Deallocated on demand in last 12 hours';
  44. const VALUE_BOOKING_REQUEST_DEALLOCATED_ON_DEMAND_24_HOURS = 'Booking Request Deallocated on demand over 24 hours';
  45. const VALUE_BOOKING_PACKAGE_REQUEST_CONFIRMED_12_HOURS = 'Booking Package Request Confirmed in last 12 hours';
  46. const VALUE_BOOKING_PACKAGE_REQUEST_CONFIRMED_24_HOURS = 'Booking Package Request Confirmed over 24 hours';
  47. const VALUE_LINKED_BOOKING_REQUEST_CONFIRMED = 'Linked Booking Request Confirmed';
  48. const VALUE_BOOKING_REQUEST_CONFIRMED_24_HOURS = 'Booking Request Confirmed';
  49. const VALUE_NO_MINIMAL_BOOKINGS_COMPLETED_LAST_WEEK = 'Minimal jobs for last week not reached: ';
  50. const DRIVER_HISTORY_TYPES = [
  51. self::TYPE_DRIVER => 'Driver',
  52. self::TYPE_BOOKING => 'Booking',
  53. ];
  54. /**
  55. * @var int
  56. */
  57. #[ORM\Column(name: 'id', type: 'integer')]
  58. #[ORM\Id]
  59. #[ORM\GeneratedValue(strategy: 'AUTO')]
  60. protected $id;
  61. /**
  62. * @var Driver
  63. */
  64. #[ORM\JoinColumn(name: 'driver_id', referencedColumnName: 'id')]
  65. #[ORM\ManyToOne(targetEntity: \AdminBundle\Entity\Driver::class, inversedBy: 'driverHistory')]
  66. protected $driver;
  67. /**
  68. * @var int
  69. */
  70. #[ORM\Column(name: 'type', type: 'integer')]
  71. protected $type;
  72. /**
  73. * @var string
  74. */
  75. #[ORM\Column(name: 'action', type: 'string', length: 64)]
  76. protected $action;
  77. /**
  78. * @var string
  79. */
  80. #[ORM\Column(name: 'value', type: 'string', length: 64, nullable: true)]
  81. protected $value;
  82. /**
  83. * @var int
  84. */
  85. #[ORM\Column(name: 'points', type: 'integer')]
  86. protected $points;
  87. /**
  88. * @var boolean
  89. */
  90. #[ORM\Column(name: 'is_auto', type: 'boolean', nullable: false, options: ['default' => 1])]
  91. protected $isAuto = true;
  92. /**
  93. * @var DateTime
  94. */
  95. #[ORM\Column(name: 'created_at', type: 'datetime')]
  96. protected $createdAt;
  97. public function __construct()
  98. {
  99. $this->createdAt = new DateTime();
  100. $this->isAuto = true;
  101. }
  102. /**
  103. * @return int
  104. */
  105. public function getId()
  106. {
  107. return $this->id;
  108. }
  109. /**
  110. * @param Driver $driver
  111. *
  112. * @return DriverHistory
  113. */
  114. public function setDriver(Driver $driver = null)
  115. {
  116. $this->driver = $driver;
  117. return $this;
  118. }
  119. /**
  120. * @return Driver
  121. */
  122. public function getDriver()
  123. {
  124. return $this->driver;
  125. }
  126. /**
  127. * @param int $type
  128. *
  129. * @return DriverHistory
  130. */
  131. public function setType($type): DriverHistory
  132. {
  133. $this->type = $type;
  134. return $this;
  135. }
  136. /**
  137. * @return int
  138. */
  139. public function getType()
  140. {
  141. return $this->type;
  142. }
  143. /**
  144. * @param string $action
  145. *
  146. * @return DriverHistory
  147. */
  148. public function setAction($action): DriverHistory
  149. {
  150. $this->action = $action;
  151. return $this;
  152. }
  153. /**
  154. * @return string
  155. */
  156. public function getAction()
  157. {
  158. return $this->action;
  159. }
  160. /**
  161. * @param string $value
  162. *
  163. * @return DriverHistory
  164. */
  165. public function setValue($value): DriverHistory
  166. {
  167. $this->value = $value;
  168. return $this;
  169. }
  170. /**
  171. * @return string
  172. */
  173. public function getValue()
  174. {
  175. return $this->value;
  176. }
  177. /**
  178. * @param int $points
  179. *
  180. * @return DriverHistory
  181. */
  182. public function setPoints($points): DriverHistory
  183. {
  184. $this->points = $points;
  185. return $this;
  186. }
  187. /**
  188. * @return int
  189. */
  190. public function getPoints()
  191. {
  192. return $this->points;
  193. }
  194. /**
  195. * @param DateTime $createdAt
  196. *
  197. * @return DriverHistory
  198. */
  199. public function setCreatedAt(DateTime $createdAt): DriverHistory
  200. {
  201. $this->createdAt = $createdAt;
  202. return $this;
  203. }
  204. /**
  205. * @return DateTime
  206. */
  207. public function getCreatedAt()
  208. {
  209. return $this->createdAt;
  210. }
  211. /**
  212. * @return bool
  213. */
  214. public function getIsAuto()
  215. {
  216. return $this->isAuto;
  217. }
  218. /**
  219. * @param string $isAuto
  220. *
  221. * @return DriverHistory
  222. */
  223. public function setIsAuto($isAuto): DriverHistory
  224. {
  225. $this->isAuto = $isAuto;
  226. return $this;
  227. }
  228. }