src/Flexy/ShopBundle/Entity/Shipping/Vehicle/ShippingVehicle.php line 15
<?php
namespace App\Flexy\ShopBundle\Entity\Shipping\Vehicle;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Flexy\ShopBundle\Entity\Resource\Agent;
use App\Flexy\ShopBundle\Repository\Shipping\ShippingVehicleRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ApiResource]
#[ORM\Entity(repositoryClass: ShippingVehicleRepository::class)]
class ShippingVehicle
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private $createdAt;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $icon;
#[ORM\Column(length: 255, nullable: true)]
private ?string $model = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $photo = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $color = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $acquisitionAt = null;
#[ORM\Column(nullable: true)]
private ?int $acquisitionKM = null;
#[ORM\Column(nullable: true)]
private ?float $acquisitionCost = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $registrationNumber = null;
#[ORM\Column(nullable: true)]
private ?bool $isActive = null;
#[ORM\OneToOne(inversedBy: 'shippingVehicle', cascade: ['persist', 'remove'])]
private ?Agent $agentDriver = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $AssignmentAt = null;
#[ORM\Column(nullable: true)]
private ?int $assignmentKM = null;
#[ORM\ManyToOne(inversedBy: 'shippingVehicles')]
private ?ShippingVehicleType $shippingVehicleType = null;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: VehicleIncident::class,cascade:["persist","remove"])]
private Collection $vehicleIncidents;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: StatusTrackingVehicle::class,cascade:["persist","remove"])]
private Collection $statusTrackings;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: VehicleConsumption::class,cascade:["persist","remove"])]
private Collection $vehicleConsumptions;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: VehicleRepair::class,cascade:["persist","remove"])]
private Collection $vehicleRepairs;
#[ORM\ManyToOne(inversedBy: 'shippingVehicles')]
private ?FuelType $fuelType = null;
#[ORM\ManyToMany(targetEntity: EquipmentVehicle::class, inversedBy: 'shippingVehicles',cascade:["persist","remove"])]
private Collection $equipments;
#[ORM\Column(length: 255, nullable: true)]
private ?string $brandName = null;
#[ORM\OneToMany(mappedBy: 'vehicle', targetEntity: VehicleRent::class,cascade:["persist","remove"])]
private Collection $vehicleRents;
#[ORM\ManyToOne(inversedBy: 'shippingVehicles')]
private ?VehicleRentType $vehicleRentType = null;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: BodyCondition::class,cascade:["persist","remove"])]
private Collection $bodyConditions;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: OilMaintenance::class,cascade:["persist","remove"])]
private Collection $oilMaintenances;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: TechnicalControl::class,cascade:["persist","remove"])]
private Collection $technicalControls;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: BrakingControl::class,cascade:["persist","remove"])]
private Collection $brakingControls;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: TireControl::class,cascade:["persist","remove"])]
private Collection $tireControls;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: DisplayControl::class,cascade:["persist","remove"])]
private Collection $displayControls;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: PowerControl::class,cascade:["persist","remove"])]
private Collection $powerControls;
#[ORM\OneToMany(mappedBy: 'shippingVehicle', targetEntity: OtherControl::class,cascade:["persist","remove"])]
private Collection $otherControls;
public function __toString()
{
return $this->brandName." ".$this->model." ".$this->registrationNumber;
}
public function __construct()
{
$this->vehicleIncidents = new ArrayCollection();
$this->statusTrackings = new ArrayCollection();
$this->vehicleConsumptions = new ArrayCollection();
$this->vehicleRepairs = new ArrayCollection();
$this->equipments = new ArrayCollection();
$this->vehicleRents = new ArrayCollection();
$this->bodyConditions = new ArrayCollection();
$this->oilMaintenances = new ArrayCollection();
$this->technicalControls = new ArrayCollection();
$this->brakingControls = new ArrayCollection();
$this->tireControls = new ArrayCollection();
$this->displayControls = new ArrayCollection();
$this->powerControls = new ArrayCollection();
$this->otherControls = new ArrayCollection();
}
/**
* Get the value of id
*/
public function getId()
{
return $this->id;
}
/**
* Get the value of createdAt
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set the value of createdAt
*
* @return self
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get the value of name
*/
public function getName()
{
return $this->name;
}
/**
* Set the value of name
*
* @return self
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get the value of icon
*/
public function getIcon()
{
return $this->icon;
}
/**
* Set the value of icon
*
* @return self
*/
public function setIcon($icon)
{
$this->icon = $icon;
return $this;
}
public function getModel(): ?string
{
return $this->model;
}
public function setModel(?string $model): self
{
$this->model = $model;
return $this;
}
public function getPhoto(): ?string
{
return $this->photo;
}
public function setPhoto(?string $photo): self
{
$this->photo = $photo;
return $this;
}
public function getColor(): ?string
{
return $this->color;
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
public function getAcquisitionAt(): ?\DateTimeInterface
{
return $this->acquisitionAt;
}
public function setAcquisitionAt(?\DateTimeInterface $acquisitionAt): self
{
$this->acquisitionAt = $acquisitionAt;
return $this;
}
public function getAcquisitionKM(): ?int
{
return $this->acquisitionKM;
}
public function setAcquisitionKM(?int $acquisitionKM): self
{
$this->acquisitionKM = $acquisitionKM;
return $this;
}
public function getAcquisitionCost(): ?float
{
return $this->acquisitionCost;
}
public function setAcquisitionCost(?float $acquisitionCost): self
{
$this->acquisitionCost = $acquisitionCost;
return $this;
}
public function getRegistrationNumber(): ?string
{
return $this->registrationNumber;
}
public function setRegistrationNumber(?string $registrationNumber): self
{
$this->registrationNumber = $registrationNumber;
return $this;
}
public function isIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(?bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getAgentDriver(): ?Agent
{
return $this->agentDriver;
}
public function setAgentDriver(?Agent $agentDriver): self
{
$this->agentDriver = $agentDriver;
return $this;
}
public function getAssignmentAt(): ?\DateTimeInterface
{
return $this->AssignmentAt;
}
public function setAssignmentAt(?\DateTimeInterface $AssignmentAt): self
{
$this->AssignmentAt = $AssignmentAt;
return $this;
}
public function getAssignmentKM(): ?int
{
return $this->assignmentKM;
}
public function setAssignmentKM(?int $assignmentKM): self
{
$this->assignmentKM = $assignmentKM;
return $this;
}
public function getShippingVehicleType(): ?ShippingVehicleType
{
return $this->shippingVehicleType;
}
public function setShippingVehicleType(?ShippingVehicleType $shippingVehicleType): self
{
$this->shippingVehicleType = $shippingVehicleType;
return $this;
}
/**
* @return Collection<int, VehicleIncident>
*/
public function getVehicleIncidents(): Collection
{
return $this->vehicleIncidents;
}
public function addVehicleIncident(VehicleIncident $vehicleIncident): self
{
if (!$this->vehicleIncidents->contains($vehicleIncident)) {
$this->vehicleIncidents->add($vehicleIncident);
$vehicleIncident->setShippingVehicle($this);
}
return $this;
}
public function removeVehicleIncident(VehicleIncident $vehicleIncident): self
{
if ($this->vehicleIncidents->removeElement($vehicleIncident)) {
// set the owning side to null (unless already changed)
if ($vehicleIncident->getShippingVehicle() === $this) {
$vehicleIncident->setShippingVehicle(null);
}
}
return $this;
}
/**
* @return Collection<int, StatusTrackingVehicle>
*/
public function getStatusTrackings(): Collection
{
return $this->statusTrackings;
}
public function addStatusTracking(StatusTrackingVehicle $statusTracking): self
{
if (!$this->statusTrackings->contains($statusTracking)) {
$this->statusTrackings->add($statusTracking);
$statusTracking->setShippingVehicle($this);
}
return $this;
}
public function removeStatusTracking(StatusTrackingVehicle $statusTracking): self
{
if ($this->statusTrackings->removeElement($statusTracking)) {
// set the owning side to null (unless already changed)
if ($statusTracking->getShippingVehicle() === $this) {
$statusTracking->setShippingVehicle(null);
}
}
return $this;
}
/**
* @return Collection<int, VehicleConsumption>
*/
public function getVehicleConsumptions(): Collection
{
return $this->vehicleConsumptions;
}
public function addVehicleConsumption(VehicleConsumption $vehicleConsumption): self
{
if (!$this->vehicleConsumptions->contains($vehicleConsumption)) {
$this->vehicleConsumptions->add($vehicleConsumption);
$vehicleConsumption->setShippingVehicle($this);
}
return $this;
}
public function removeVehicleConsumption(VehicleConsumption $vehicleConsumption): self
{
if ($this->vehicleConsumptions->removeElement($vehicleConsumption)) {
// set the owning side to null (unless already changed)
if ($vehicleConsumption->getShippingVehicle() === $this) {
$vehicleConsumption->setShippingVehicle(null);
}
}
return $this;
}
/**
* @return Collection<int, VehicleRepair>
*/
public function getVehicleRepairs(): Collection
{
return $this->vehicleRepairs;
}
public function addVehicleRepair(VehicleRepair $vehicleRepair): self
{
if (!$this->vehicleRepairs->contains($vehicleRepair)) {
$this->vehicleRepairs->add($vehicleRepair);
$vehicleRepair->setShippingVehicle($this);
}
return $this;
}
public function removeVehicleRepair(VehicleRepair $vehicleRepair): self
{
if ($this->vehicleRepairs->removeElement($vehicleRepair)) {
// set the owning side to null (unless already changed)
if ($vehicleRepair->getShippingVehicle() === $this) {
$vehicleRepair->setShippingVehicle(null);
}
}
return $this;
}
public function getFuelType(): ?FuelType
{
return $this->fuelType;
}
public function setFuelType(?FuelType $fuelType): self
{
$this->fuelType = $fuelType;
return $this;
}
/**
* @return Collection<int, EquipmentVehicle>
*/
public function getEquipments(): Collection
{
return $this->equipments;
}
public function addEquipment(EquipmentVehicle $equipment): self
{
if (!$this->equipments->contains($equipment)) {
$this->equipments->add($equipment);
}
return $this;
}
public function removeEquipment(EquipmentVehicle $equipment): self
{
$this->equipments->removeElement($equipment);
return $this;
}
public function getBrandName(): ?string
{
return $this->brandName;
}
public function setBrandName(?string $brandName): self
{
$this->brandName = $brandName;
return $this;
}
/**
* @return Collection<int, VehicleRent>
*/
public function getVehicleRents(): Collection
{
return $this->vehicleRents;
}
public function addVehicleRent(VehicleRent $vehicleRent): self
{
if (!$this->vehicleRents->contains($vehicleRent)) {
$this->vehicleRents->add($vehicleRent);
$vehicleRent->setVehicle($this);
}
return $this;
}
public function removeVehicleRent(VehicleRent $vehicleRent): self
{
if ($this->vehicleRents->removeElement($vehicleRent)) {
// set the owning side to null (unless already changed)
if ($vehicleRent->getVehicle() === $this) {
$vehicleRent->setVehicle(null);
}
}
return $this;
}
public function getVehicleRentType(): ?VehicleRentType
{
return $this->vehicleRentType;
}
public function setVehicleRentType(?VehicleRentType $vehicleRentType): self
{
$this->vehicleRentType = $vehicleRentType;
return $this;
}
/**
* @return Collection<int, BodyCondition>
*/
public function getBodyConditions(): Collection
{
return $this->bodyConditions;
}
public function addBodyCondition(BodyCondition $bodyCondition): self
{
if (!$this->bodyConditions->contains($bodyCondition)) {
$this->bodyConditions->add($bodyCondition);
$bodyCondition->setShippingVehicle($this);
}
return $this;
}
public function removeBodyCondition(BodyCondition $bodyCondition): self
{
if ($this->bodyConditions->removeElement($bodyCondition)) {
// set the owning side to null (unless already changed)
if ($bodyCondition->getShippingVehicle() === $this) {
$bodyCondition->setShippingVehicle(null);
}
}
return $this;
}
/**
* @return Collection<int, OilMaintenance>
*/
public function getOilMaintenances(): Collection
{
return $this->oilMaintenances;
}
public function addOilMaintenance(OilMaintenance $oilMaintenance): self
{
if (!$this->oilMaintenances->contains($oilMaintenance)) {
$this->oilMaintenances->add($oilMaintenance);
$oilMaintenance->setShippingVehicle($this);
}
return $this;
}
public function removeOilMaintenance(OilMaintenance $oilMaintenance): self
{
if ($this->oilMaintenances->removeElement($oilMaintenance)) {
// set the owning side to null (unless already changed)
if ($oilMaintenance->getShippingVehicle() === $this) {
$oilMaintenance->setShippingVehicle(null);
}
}
return $this;
}
/**
* @return Collection<int, TechnicalControl>
*/
public function getTechnicalControls(): Collection
{
return $this->technicalControls;
}
public function addTechnicalControl(TechnicalControl $technicalControl): self
{
if (!$this->technicalControls->contains($technicalControl)) {
$this->technicalControls->add($technicalControl);
$technicalControl->setShippingVehicle($this);
}
return $this;
}
public function removeTechnicalControl(TechnicalControl $technicalControl): self
{
if ($this->technicalControls->removeElement($technicalControl)) {
// set the owning side to null (unless already changed)
if ($technicalControl->getShippingVehicle() === $this) {
$technicalControl->setShippingVehicle(null);
}
}
return $this;
}
/**
* @return Collection<int, BrakingControl>
*/
public function getBrakingControls(): Collection
{
return $this->brakingControls;
}
public function addBrakingControl(BrakingControl $brakingControl): self
{
if (!$this->brakingControls->contains($brakingControl)) {
$this->brakingControls->add($brakingControl);
$brakingControl->setShippingVehicle($this);
}
return $this;
}
public function removeBrakingControl(BrakingControl $brakingControl): self
{
if ($this->brakingControls->removeElement($brakingControl)) {
// set the owning side to null (unless already changed)
if ($brakingControl->getShippingVehicle() === $this) {
$brakingControl->setShippingVehicle(null);
}
}
return $this;
}
/**
* @return Collection<int, TireControl>
*/
public function getTireControls(): Collection
{
return $this->tireControls;
}
public function addTireControl(TireControl $tireControl): self
{
if (!$this->tireControls->contains($tireControl)) {
$this->tireControls->add($tireControl);
$tireControl->setShippingVehicle($this);
}
return $this;
}
public function removeTireControl(TireControl $tireControl): self
{
if ($this->tireControls->removeElement($tireControl)) {
// set the owning side to null (unless already changed)
if ($tireControl->getShippingVehicle() === $this) {
$tireControl->setShippingVehicle(null);
}
}
return $this;
}
/**
* @return Collection<int, DisplayControl>
*/
public function getDisplayControls(): Collection
{
return $this->displayControls;
}
public function addDisplayControl(DisplayControl $displayControl): self
{
if (!$this->displayControls->contains($displayControl)) {
$this->displayControls->add($displayControl);
$displayControl->setShippingVehicle($this);
}
return $this;
}
public function removeDisplayControl(DisplayControl $displayControl): self
{
if ($this->displayControls->removeElement($displayControl)) {
// set the owning side to null (unless already changed)
if ($displayControl->getShippingVehicle() === $this) {
$displayControl->setShippingVehicle(null);
}
}
return $this;
}
/**
* @return Collection<int, PowerControl>
*/
public function getPowerControls(): Collection
{
return $this->powerControls;
}
public function addPowerControl(PowerControl $powerControl): self
{
if (!$this->powerControls->contains($powerControl)) {
$this->powerControls->add($powerControl);
$powerControl->setShippingVehicle($this);
}
return $this;
}
public function removePowerControl(PowerControl $powerControl): self
{
if ($this->powerControls->removeElement($powerControl)) {
// set the owning side to null (unless already changed)
if ($powerControl->getShippingVehicle() === $this) {
$powerControl->setShippingVehicle(null);
}
}
return $this;
}
/**
* @return Collection<int, OtherControl>
*/
public function getOtherControls(): Collection
{
return $this->otherControls;
}
public function addOtherControl(OtherControl $otherControl): self
{
if (!$this->otherControls->contains($otherControl)) {
$this->otherControls->add($otherControl);
$otherControl->setShippingVehicle($this);
}
return $this;
}
public function removeOtherControl(OtherControl $otherControl): self
{
if ($this->otherControls->removeElement($otherControl)) {
// set the owning side to null (unless already changed)
if ($otherControl->getShippingVehicle() === $this) {
$otherControl->setShippingVehicle(null);
}
}
return $this;
}
}