<?phpnamespace AdminBundle\Entity;use Doctrine\ORM\Mapping as ORM;/** * DriverHistoryCars */#[ORM\Table(name: 'driver_history_cars')]#[ORM\Index(name: 'date_index', columns: ['date'])]#[ORM\Entity(repositoryClass: \AdminBundle\Repository\DriverHistoryCarsRepository::class)]class DriverHistoryCars{ const ACTION_REMOVE = 0; const ACTION_ADD = 1; /** * @var int */ #[ORM\Column(name: 'id', type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'AUTO')] private $id; /** * @var int */ #[ORM\Column(name: 'car_id', type: 'integer')] private $carId; /** * @var int */ #[ORM\Column(name: 'action', type: 'smallint')] private $action = self::ACTION_ADD; /** * @var \DateTime */ #[ORM\Column(name: 'date', type: 'datetime')] private $date; /** * @var array */ #[ORM\Column(name: 'car_info', type: 'json')] private $carInfo; /** * @var User */ #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')] #[ORM\ManyToOne(targetEntity: \AdminBundle\Entity\User::class)] private $user; /** * @var Driver */ #[ORM\JoinColumn(name: 'driver_id', referencedColumnName: 'id')] #[ORM\ManyToOne(targetEntity: \AdminBundle\Entity\Driver::class, inversedBy: 'historyCars')] private $driver; /** * DriverHistoryCars constructor. */ public function __construct() { $this->date = new \DateTime(); } /** * Get id * * @return int */ public function getId() { return $this->id; } /** * Set carId * * @param integer $carId * * @return DriverHistoryCars */ public function setCarId($carId) { $this->carId = $carId; return $this; } /** * Get carId * * @return int */ public function getCarId() { return $this->carId; } /** * Set action * * @param integer $action * * @return DriverHistoryCars */ public function setAction($action) { $this->action = $action; return $this; } /** * Get action * * @return int */ public function getAction() { return $this->action; } /** * Set date * * @param \DateTime $date * * @return DriverHistoryCars */ public function setDate($date) { $this->date = $date; return $this; } /** * Get date * * @return \DateTime */ public function getDate() { return $this->date; } /** * Set carInfo * * @param array $carInfo * * @return DriverHistoryCars */ public function setCarInfo($carInfo) { $this->carInfo = $carInfo; return $this; } /** * Get carInfo * * @return array */ public function getCarInfo() { return $this->carInfo; } /** * Set user * * @param \AdminBundle\Entity\User $user * * @return DriverHistoryCars */ public function setUser(\AdminBundle\Entity\User $user = null) { $this->user = $user; return $this; } /** * Get user * * @return \AdminBundle\Entity\User */ public function getUser() { return $this->user; } /** * Set driver * * @param \AdminBundle\Entity\Driver $driver * * @return DriverHistoryCars */ public function setDriver(\AdminBundle\Entity\Driver $driver = null) { $this->driver = $driver; return $this; } /** * Get driver * * @return \AdminBundle\Entity\Driver */ public function getDriver() { return $this->driver; }}