src/Entity/Fleet/Vehicle.php line 23

  1. <?php
  2. namespace App\Entity\Fleet;
  3. use App\Doctrine\Type\Fleet\OperatingStatus;
  4. use App\Entity\Common as Common;
  5. use App\Entity\Common\Company;
  6. use App\Validator\IsValidEnum\IsValidEnum;
  7. use DateTimeInterface;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  11. use Symfony\Component\Uid\Ulid;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. #[ORM\Table(name'fleet_vehicle')]
  14. #[ORM\Index(columns: ['owner_id'], name'fleet_vehicle_owner_id_idx')]
  15. #[ORM\Index(columns: ['created_by'], name'fleet_vehicle_created_by_idx')]
  16. #[ORM\Index(columns: ['updated_by'], name'fleet_vehicle_updated_by_idx')]
  17. #[ORM\UniqueConstraint(name'fleet_vehicle_identifier_key'columns: ['identifier'])]
  18. #[ORM\Entity]
  19. #[UniqueEntity(fields: ['identifier'])]
  20. class Vehicle
  21. {
  22.     use Common\Blameable;
  23.     use Common\Trackable;
  24.     #[ORM\Id]
  25.     #[ORM\GeneratedValue(strategy'IDENTITY')]
  26.     #[ORM\SequenceGenerator(sequenceName'fleet_vehicle_id_seq')]
  27.     #[ORM\Column(typeTypes::INTEGER)]
  28.     private ?int $id null;
  29.     #[Assert\Ulid]
  30.     #[Assert\NotNull]
  31.     #[ORM\Column(type'ulid'uniquetrue)]
  32.     private ?Ulid $identifier null;
  33.     #[ORM\ManyToOne(targetEntityCompany::class)]
  34.     #[ORM\JoinColumn(name'owner_id')]
  35.     private ?Company $owner null;
  36.     #[Assert\Type(typeTypes::STRING)]
  37.     #[ORM\Column(typeTypes::STRINGnullabletrue)]
  38.     private ?string $make null;
  39.     #[Assert\Type(typeTypes::STRING)]
  40.     #[ORM\Column(typeTypes::STRINGnullabletrue)]
  41.     private ?string $model null;
  42.     #[Assert\NotBlank]
  43.     #[Assert\Type(typeTypes::STRING)]
  44.     #[ORM\Column(typeTypes::STRING)]
  45.     private ?string $frontNumber null;
  46.     #[Assert\NotBlank]
  47.     #[Assert\Type(typeTypes::STRING)]
  48.     #[ORM\Column(typeTypes::STRING)]
  49.     private ?string $rearNumber null;
  50.     #[Assert\Type(typeDateTimeInterface::class)]
  51.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  52.     private ?DateTimeInterface $registeredOn null;
  53.     #[Assert\NotBlank]
  54.     #[Assert\Type(typeTypes::STRING)]
  55.     #[ORM\Column(typeTypes::STRING)]
  56.     private ?string $countryOfOperation null;
  57.     #[Assert\NotNull]
  58.     #[IsValidEnum(enumOperatingStatus::class)]
  59.     #[ORM\Column(typeTypes::STRINGnullablefalseenumTypeOperatingStatus::class, options: ['default' => 'OPERATIONAL'])]
  60.     private ?OperatingStatus $status OperatingStatus::OPERATIONAL;
  61.     public function __construct()
  62.     {
  63.         $this->identifier = new Ulid();
  64.     }
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getIdentifier(): ?Ulid
  70.     {
  71.         return $this->identifier;
  72.     }
  73.     public function setIdentifier($identifier): self
  74.     {
  75.         $this->identifier $identifier;
  76.         return $this;
  77.     }
  78.     public function getOwner(): ?Company
  79.     {
  80.         return $this->owner;
  81.     }
  82.     public function setOwner(Company $owner): self
  83.     {
  84.         $this->owner $owner;
  85.         return $this;
  86.     }
  87.     public function getMake(): ?string
  88.     {
  89.         return $this->make;
  90.     }
  91.     public function setMake(?string $make): self
  92.     {
  93.         $this->make $make;
  94.         return $this;
  95.     }
  96.     public function getModel(): ?string
  97.     {
  98.         return $this->model;
  99.     }
  100.     public function setModel(?string $model): self
  101.     {
  102.         $this->model $model;
  103.         return $this;
  104.     }
  105.     public function getFrontNumber(): ?string
  106.     {
  107.         return $this->frontNumber;
  108.     }
  109.     public function setFrontNumber(?string $frontNumber): self
  110.     {
  111.         $this->frontNumber $frontNumber;
  112.         return $this;
  113.     }
  114.     public function getRearNumber(): ?string
  115.     {
  116.         return $this->rearNumber;
  117.     }
  118.     public function setRearNumber(?string $rearNumber): self
  119.     {
  120.         $this->rearNumber $rearNumber;
  121.         return $this;
  122.     }
  123.     public function getRegisteredOn(): ?DateTimeInterface
  124.     {
  125.         return $this->registeredOn;
  126.     }
  127.     public function setRegisteredOn(?DateTimeInterface $registeredOn): self
  128.     {
  129.         $this->registeredOn $registeredOn;
  130.         return $this;
  131.     }
  132.     public function getCountryOfOperation(): ?string
  133.     {
  134.         return $this->countryOfOperation;
  135.     }
  136.     public function setCountryOfOperation(?string $countryOfOperation): self
  137.     {
  138.         $this->countryOfOperation $countryOfOperation;
  139.         return $this;
  140.     }
  141.     public function getStatus(): ?OperatingStatus
  142.     {
  143.         return $this->status;
  144.     }
  145.     public function setStatus(?OperatingStatus $status): self
  146.     {
  147.         $this->status $status;
  148.         return $this;
  149.     }
  150. }