src/Entity/VehicleStatistic.php line 10

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VehicleStatisticRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassVehicleStatisticRepository::class)]
  6. #[ORM\UniqueConstraint(name'unique_vehicle_action_period'columns: ['vehicle_id''action''month''year'])]
  7. class VehicleStatistic
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\ManyToOne]
  14.     #[ORM\JoinColumn(nullablefalse)]
  15.     private ?Vehicle $vehicle null;
  16.     #[ORM\Column(length50)]
  17.     private ?string $action null;
  18.     #[ORM\Column(type'smallint')]
  19.     private ?int $month null;
  20.     #[ORM\Column(type'smallint')]
  21.     private ?int $year null;
  22.     #[ORM\Column(type'integer'options: ['default' => 1])]
  23.     private int $count 1;
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getVehicle(): ?Vehicle
  29.     {
  30.         return $this->vehicle;
  31.     }
  32.     public function setVehicle(?Vehicle $vehicle): static
  33.     {
  34.         $this->vehicle $vehicle;
  35.         return $this;
  36.     }
  37.     public function getAction(): ?string
  38.     {
  39.         return $this->action;
  40.     }
  41.     public function setAction(string $action): static
  42.     {
  43.         $this->action $action;
  44.         return $this;
  45.     }
  46.     public function getMonth(): ?int
  47.     {
  48.         return $this->month;
  49.     }
  50.     public function setMonth(int $month): static
  51.     {
  52.         $this->month $month;
  53.         return $this;
  54.     }
  55.     public function getYear(): ?int
  56.     {
  57.         return $this->year;
  58.     }
  59.     public function setYear(int $year): static
  60.     {
  61.         $this->year $year;
  62.         return $this;
  63.     }
  64.     public function getCount(): int
  65.     {
  66.         return $this->count;
  67.     }
  68.     public function setCount(int $count): static
  69.     {
  70.         $this->count $count;
  71.         return $this;
  72.     }
  73.     public function incrementCount(int $increment 1): static
  74.     {
  75.         $this->count += $increment;
  76.         return $this;
  77.     }
  78. }