src/Entity/Fleet/Vehicle.php line 23
<?php
namespace App\Entity\Fleet;
use App\Doctrine\Type\Fleet\OperatingStatus;
use App\Entity\Common as Common;
use App\Entity\Common\Company;
use App\Validator\IsValidEnum\IsValidEnum;
use DateTimeInterface;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Uid\Ulid;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Table(name: 'fleet_vehicle')]
#[ORM\Index(columns: ['owner_id'], name: 'fleet_vehicle_owner_id_idx')]
#[ORM\Index(columns: ['created_by'], name: 'fleet_vehicle_created_by_idx')]
#[ORM\Index(columns: ['updated_by'], name: 'fleet_vehicle_updated_by_idx')]
#[ORM\UniqueConstraint(name: 'fleet_vehicle_identifier_key', columns: ['identifier'])]
#[ORM\Entity]
#[UniqueEntity(fields: ['identifier'])]
class Vehicle
{
use Common\Blameable;
use Common\Trackable;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'fleet_vehicle_id_seq')]
#[ORM\Column(type: Types::INTEGER)]
private ?int $id = null;
#[Assert\Ulid]
#[Assert\NotNull]
#[ORM\Column(type: 'ulid', unique: true)]
private ?Ulid $identifier = null;
#[ORM\ManyToOne(targetEntity: Company::class)]
#[ORM\JoinColumn(name: 'owner_id')]
private ?Company $owner = null;
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING, nullable: true)]
private ?string $make = null;
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING, nullable: true)]
private ?string $model = null;
#[Assert\NotBlank]
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING)]
private ?string $frontNumber = null;
#[Assert\NotBlank]
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING)]
private ?string $rearNumber = null;
#[Assert\Type(type: DateTimeInterface::class)]
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?DateTimeInterface $registeredOn = null;
#[Assert\NotBlank]
#[Assert\Type(type: Types::STRING)]
#[ORM\Column(type: Types::STRING)]
private ?string $countryOfOperation = null;
#[Assert\NotNull]
#[IsValidEnum(enum: OperatingStatus::class)]
#[ORM\Column(type: Types::STRING, nullable: false, enumType: OperatingStatus::class, options: ['default' => 'OPERATIONAL'])]
private ?OperatingStatus $status = OperatingStatus::OPERATIONAL;
public function __construct()
{
$this->identifier = new Ulid();
}
public function getId(): ?int
{
return $this->id;
}
public function getIdentifier(): ?Ulid
{
return $this->identifier;
}
public function setIdentifier($identifier): self
{
$this->identifier = $identifier;
return $this;
}
public function getOwner(): ?Company
{
return $this->owner;
}
public function setOwner(Company $owner): self
{
$this->owner = $owner;
return $this;
}
public function getMake(): ?string
{
return $this->make;
}
public function setMake(?string $make): self
{
$this->make = $make;
return $this;
}
public function getModel(): ?string
{
return $this->model;
}
public function setModel(?string $model): self
{
$this->model = $model;
return $this;
}
public function getFrontNumber(): ?string
{
return $this->frontNumber;
}
public function setFrontNumber(?string $frontNumber): self
{
$this->frontNumber = $frontNumber;
return $this;
}
public function getRearNumber(): ?string
{
return $this->rearNumber;
}
public function setRearNumber(?string $rearNumber): self
{
$this->rearNumber = $rearNumber;
return $this;
}
public function getRegisteredOn(): ?DateTimeInterface
{
return $this->registeredOn;
}
public function setRegisteredOn(?DateTimeInterface $registeredOn): self
{
$this->registeredOn = $registeredOn;
return $this;
}
public function getCountryOfOperation(): ?string
{
return $this->countryOfOperation;
}
public function setCountryOfOperation(?string $countryOfOperation): self
{
$this->countryOfOperation = $countryOfOperation;
return $this;
}
public function getStatus(): ?OperatingStatus
{
return $this->status;
}
public function setStatus(?OperatingStatus $status): self
{
$this->status = $status;
return $this;
}
}