src/AdminBundle/Entity/DriverHistoryCars.php line 186

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * DriverHistoryCars
  6. */
  7. #[ORM\Table(name: 'driver_history_cars')]
  8. #[ORM\Index(name: 'date_index', columns: ['date'])]
  9. #[ORM\Entity(repositoryClass: \AdminBundle\Repository\DriverHistoryCarsRepository::class)]
  10. class DriverHistoryCars
  11. {
  12. const ACTION_REMOVE = 0;
  13. const ACTION_ADD = 1;
  14. /**
  15. * @var int
  16. */
  17. #[ORM\Column(name: 'id', type: 'integer')]
  18. #[ORM\Id]
  19. #[ORM\GeneratedValue(strategy: 'AUTO')]
  20. private $id;
  21. /**
  22. * @var int
  23. */
  24. #[ORM\Column(name: 'car_id', type: 'integer')]
  25. private $carId;
  26. /**
  27. * @var int
  28. */
  29. #[ORM\Column(name: 'action', type: 'smallint')]
  30. private $action = self::ACTION_ADD;
  31. /**
  32. * @var \DateTime
  33. */
  34. #[ORM\Column(name: 'date', type: 'datetime')]
  35. private $date;
  36. /**
  37. * @var array
  38. */
  39. #[ORM\Column(name: 'car_info', type: 'json')]
  40. private $carInfo;
  41. /**
  42. * @var User
  43. */
  44. #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
  45. #[ORM\ManyToOne(targetEntity: \AdminBundle\Entity\User::class)]
  46. private $user;
  47. /**
  48. * @var Driver
  49. */
  50. #[ORM\JoinColumn(name: 'driver_id', referencedColumnName: 'id')]
  51. #[ORM\ManyToOne(targetEntity: \AdminBundle\Entity\Driver::class, inversedBy: 'historyCars')]
  52. private $driver;
  53. /**
  54. * DriverHistoryCars constructor.
  55. */
  56. public function __construct()
  57. {
  58. $this->date = new \DateTime();
  59. }
  60. /**
  61. * Get id
  62. *
  63. * @return int
  64. */
  65. public function getId()
  66. {
  67. return $this->id;
  68. }
  69. /**
  70. * Set carId
  71. *
  72. * @param integer $carId
  73. *
  74. * @return DriverHistoryCars
  75. */
  76. public function setCarId($carId)
  77. {
  78. $this->carId = $carId;
  79. return $this;
  80. }
  81. /**
  82. * Get carId
  83. *
  84. * @return int
  85. */
  86. public function getCarId()
  87. {
  88. return $this->carId;
  89. }
  90. /**
  91. * Set action
  92. *
  93. * @param integer $action
  94. *
  95. * @return DriverHistoryCars
  96. */
  97. public function setAction($action)
  98. {
  99. $this->action = $action;
  100. return $this;
  101. }
  102. /**
  103. * Get action
  104. *
  105. * @return int
  106. */
  107. public function getAction()
  108. {
  109. return $this->action;
  110. }
  111. /**
  112. * Set date
  113. *
  114. * @param \DateTime $date
  115. *
  116. * @return DriverHistoryCars
  117. */
  118. public function setDate($date)
  119. {
  120. $this->date = $date;
  121. return $this;
  122. }
  123. /**
  124. * Get date
  125. *
  126. * @return \DateTime
  127. */
  128. public function getDate()
  129. {
  130. return $this->date;
  131. }
  132. /**
  133. * Set carInfo
  134. *
  135. * @param array $carInfo
  136. *
  137. * @return DriverHistoryCars
  138. */
  139. public function setCarInfo($carInfo)
  140. {
  141. $this->carInfo = $carInfo;
  142. return $this;
  143. }
  144. /**
  145. * Get carInfo
  146. *
  147. * @return array
  148. */
  149. public function getCarInfo()
  150. {
  151. return $this->carInfo;
  152. }
  153. /**
  154. * Set user
  155. *
  156. * @param \AdminBundle\Entity\User $user
  157. *
  158. * @return DriverHistoryCars
  159. */
  160. public function setUser(\AdminBundle\Entity\User $user = null)
  161. {
  162. $this->user = $user;
  163. return $this;
  164. }
  165. /**
  166. * Get user
  167. *
  168. * @return \AdminBundle\Entity\User
  169. */
  170. public function getUser()
  171. {
  172. return $this->user;
  173. }
  174. /**
  175. * Set driver
  176. *
  177. * @param \AdminBundle\Entity\Driver $driver
  178. *
  179. * @return DriverHistoryCars
  180. */
  181. public function setDriver(\AdminBundle\Entity\Driver $driver = null)
  182. {
  183. $this->driver = $driver;
  184. return $this;
  185. }
  186. /**
  187. * Get driver
  188. *
  189. * @return \AdminBundle\Entity\Driver
  190. */
  191. public function getDriver()
  192. {
  193. return $this->driver;
  194. }
  195. }