src/Flexy/ShopBundle/Entity/Shipping/Vehicle/ShippingVehicle.php line 15

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Shipping\Vehicle;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Resource\Agent;
  5. use App\Flexy\ShopBundle\Repository\Shipping\ShippingVehicleRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. #[ApiResource]
  11. #[ORM\Entity(repositoryClassShippingVehicleRepository::class)]
  12. class ShippingVehicle
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(type'integer')]
  17.     private $id;
  18.     #[ORM\Column(type'datetime_immutable'nullabletrue)]
  19.     private $createdAt;
  20.     #[ORM\Column(type'string'length255)]
  21.     private $name;
  22.     #[ORM\Column(type'string'length255nullabletrue)]
  23.     private $icon;
  24.     #[ORM\Column(length255nullabletrue)]
  25.     private ?string $model null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $photo null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $color null;
  30.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  31.     private ?\DateTimeInterface $acquisitionAt null;
  32.     #[ORM\Column(nullabletrue)]
  33.     private ?int $acquisitionKM null;
  34.     #[ORM\Column(nullabletrue)]
  35.     private ?float $acquisitionCost null;
  36.     #[ORM\Column(length255nullabletrue)]
  37.     private ?string $registrationNumber null;
  38.     #[ORM\Column(nullabletrue)]
  39.     private ?bool $isActive null;
  40.     #[ORM\OneToOne(inversedBy'shippingVehicle'cascade: ['persist''remove'])]
  41.     private ?Agent $agentDriver null;
  42.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  43.     private ?\DateTimeInterface $AssignmentAt null;
  44.     #[ORM\Column(nullabletrue)]
  45.     private ?int $assignmentKM null;
  46.     #[ORM\ManyToOne(inversedBy'shippingVehicles')]
  47.     private ?ShippingVehicleType $shippingVehicleType null;
  48.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityVehicleIncident::class,cascade:["persist","remove"])]
  49.     private Collection $vehicleIncidents;
  50.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityStatusTrackingVehicle::class,cascade:["persist","remove"])]
  51.     private Collection $statusTrackings;
  52.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityVehicleConsumption::class,cascade:["persist","remove"])]
  53.     private Collection $vehicleConsumptions;
  54.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityVehicleRepair::class,cascade:["persist","remove"])]
  55.     private Collection $vehicleRepairs;
  56.     #[ORM\ManyToOne(inversedBy'shippingVehicles')]
  57.     private ?FuelType $fuelType null;
  58.     #[ORM\ManyToMany(targetEntityEquipmentVehicle::class, inversedBy'shippingVehicles',cascade:["persist","remove"])]
  59.     private Collection $equipments;
  60.     #[ORM\Column(length255nullabletrue)]
  61.     private ?string $brandName null;
  62.     #[ORM\OneToMany(mappedBy'vehicle'targetEntityVehicleRent::class,cascade:["persist","remove"])]
  63.     private Collection $vehicleRents;
  64.     #[ORM\ManyToOne(inversedBy'shippingVehicles')]
  65.     private ?VehicleRentType $vehicleRentType null;
  66.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityBodyCondition::class,cascade:["persist","remove"])]
  67.     private Collection $bodyConditions;
  68.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityOilMaintenance::class,cascade:["persist","remove"])]
  69.     private Collection $oilMaintenances;
  70.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityTechnicalControl::class,cascade:["persist","remove"])]
  71.     private Collection $technicalControls;
  72.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityBrakingControl::class,cascade:["persist","remove"])]
  73.     private Collection $brakingControls;
  74.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityTireControl::class,cascade:["persist","remove"])]
  75.     private Collection $tireControls;
  76.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityDisplayControl::class,cascade:["persist","remove"])]
  77.     private Collection $displayControls;
  78.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityPowerControl::class,cascade:["persist","remove"])]
  79.     private Collection $powerControls;
  80.     #[ORM\OneToMany(mappedBy'shippingVehicle'targetEntityOtherControl::class,cascade:["persist","remove"])]
  81.     private Collection $otherControls;
  82.     public function __toString()
  83.     {
  84.         return $this->brandName." ".$this->model." ".$this->registrationNumber;
  85.     }
  86.     public function __construct()
  87.     {
  88.         $this->vehicleIncidents = new ArrayCollection();
  89.         $this->statusTrackings = new ArrayCollection();
  90.         $this->vehicleConsumptions = new ArrayCollection();
  91.         $this->vehicleRepairs = new ArrayCollection();
  92.         $this->equipments = new ArrayCollection();
  93.         $this->vehicleRents = new ArrayCollection();
  94.         $this->bodyConditions = new ArrayCollection();
  95.         $this->oilMaintenances = new ArrayCollection();
  96.         $this->technicalControls = new ArrayCollection();
  97.         $this->brakingControls = new ArrayCollection();
  98.         $this->tireControls = new ArrayCollection();
  99.         $this->displayControls = new ArrayCollection();
  100.         $this->powerControls = new ArrayCollection();
  101.         $this->otherControls = new ArrayCollection();
  102.     }
  103.     /**
  104.      * Get the value of id
  105.      */ 
  106.     public function getId()
  107.     {
  108.         return $this->id;
  109.     }
  110.     /**
  111.      * Get the value of createdAt
  112.      */ 
  113.     public function getCreatedAt()
  114.     {
  115.         return $this->createdAt;
  116.     }
  117.     /**
  118.      * Set the value of createdAt
  119.      *
  120.      * @return  self
  121.      */ 
  122.     public function setCreatedAt($createdAt)
  123.     {
  124.         $this->createdAt $createdAt;
  125.         return $this;
  126.     }
  127.     /**
  128.      * Get the value of name
  129.      */ 
  130.     public function getName()
  131.     {
  132.         return $this->name;
  133.     }
  134.     /**
  135.      * Set the value of name
  136.      *
  137.      * @return  self
  138.      */ 
  139.     public function setName($name)
  140.     {
  141.         $this->name $name;
  142.         return $this;
  143.     }
  144.     /**
  145.      * Get the value of icon
  146.      */ 
  147.     public function getIcon()
  148.     {
  149.         return $this->icon;
  150.     }
  151.     /**
  152.      * Set the value of icon
  153.      *
  154.      * @return  self
  155.      */ 
  156.     public function setIcon($icon)
  157.     {
  158.         $this->icon $icon;
  159.         return $this;
  160.     }
  161.     public function getModel(): ?string
  162.     {
  163.         return $this->model;
  164.     }
  165.     public function setModel(?string $model): self
  166.     {
  167.         $this->model $model;
  168.         return $this;
  169.     }
  170.     public function getPhoto(): ?string
  171.     {
  172.         return $this->photo;
  173.     }
  174.     public function setPhoto(?string $photo): self
  175.     {
  176.         $this->photo $photo;
  177.         return $this;
  178.     }
  179.     public function getColor(): ?string
  180.     {
  181.         return $this->color;
  182.     }
  183.     public function setColor(?string $color): self
  184.     {
  185.         $this->color $color;
  186.         return $this;
  187.     }
  188.     public function getAcquisitionAt(): ?\DateTimeInterface
  189.     {
  190.         return $this->acquisitionAt;
  191.     }
  192.     public function setAcquisitionAt(?\DateTimeInterface $acquisitionAt): self
  193.     {
  194.         $this->acquisitionAt $acquisitionAt;
  195.         return $this;
  196.     }
  197.     public function getAcquisitionKM(): ?int
  198.     {
  199.         return $this->acquisitionKM;
  200.     }
  201.     public function setAcquisitionKM(?int $acquisitionKM): self
  202.     {
  203.         $this->acquisitionKM $acquisitionKM;
  204.         return $this;
  205.     }
  206.     public function getAcquisitionCost(): ?float
  207.     {
  208.         return $this->acquisitionCost;
  209.     }
  210.     public function setAcquisitionCost(?float $acquisitionCost): self
  211.     {
  212.         $this->acquisitionCost $acquisitionCost;
  213.         return $this;
  214.     }
  215.     public function getRegistrationNumber(): ?string
  216.     {
  217.         return $this->registrationNumber;
  218.     }
  219.     public function setRegistrationNumber(?string $registrationNumber): self
  220.     {
  221.         $this->registrationNumber $registrationNumber;
  222.         return $this;
  223.     }
  224.     public function isIsActive(): ?bool
  225.     {
  226.         return $this->isActive;
  227.     }
  228.     public function setIsActive(?bool $isActive): self
  229.     {
  230.         $this->isActive $isActive;
  231.         return $this;
  232.     }
  233.     public function getAgentDriver(): ?Agent
  234.     {
  235.         return $this->agentDriver;
  236.     }
  237.     public function setAgentDriver(?Agent $agentDriver): self
  238.     {
  239.         $this->agentDriver $agentDriver;
  240.         return $this;
  241.     }
  242.     public function getAssignmentAt(): ?\DateTimeInterface
  243.     {
  244.         return $this->AssignmentAt;
  245.     }
  246.     public function setAssignmentAt(?\DateTimeInterface $AssignmentAt): self
  247.     {
  248.         $this->AssignmentAt $AssignmentAt;
  249.         return $this;
  250.     }
  251.     public function getAssignmentKM(): ?int
  252.     {
  253.         return $this->assignmentKM;
  254.     }
  255.     public function setAssignmentKM(?int $assignmentKM): self
  256.     {
  257.         $this->assignmentKM $assignmentKM;
  258.         return $this;
  259.     }
  260.     public function getShippingVehicleType(): ?ShippingVehicleType
  261.     {
  262.         return $this->shippingVehicleType;
  263.     }
  264.     public function setShippingVehicleType(?ShippingVehicleType $shippingVehicleType): self
  265.     {
  266.         $this->shippingVehicleType $shippingVehicleType;
  267.         return $this;
  268.     }
  269.     /**
  270.      * @return Collection<int, VehicleIncident>
  271.      */
  272.     public function getVehicleIncidents(): Collection
  273.     {
  274.         return $this->vehicleIncidents;
  275.     }
  276.     public function addVehicleIncident(VehicleIncident $vehicleIncident): self
  277.     {
  278.         if (!$this->vehicleIncidents->contains($vehicleIncident)) {
  279.             $this->vehicleIncidents->add($vehicleIncident);
  280.             $vehicleIncident->setShippingVehicle($this);
  281.         }
  282.         return $this;
  283.     }
  284.     public function removeVehicleIncident(VehicleIncident $vehicleIncident): self
  285.     {
  286.         if ($this->vehicleIncidents->removeElement($vehicleIncident)) {
  287.             // set the owning side to null (unless already changed)
  288.             if ($vehicleIncident->getShippingVehicle() === $this) {
  289.                 $vehicleIncident->setShippingVehicle(null);
  290.             }
  291.         }
  292.         return $this;
  293.     }
  294.     /**
  295.      * @return Collection<int, StatusTrackingVehicle>
  296.      */
  297.     public function getStatusTrackings(): Collection
  298.     {
  299.         return $this->statusTrackings;
  300.     }
  301.     public function addStatusTracking(StatusTrackingVehicle $statusTracking): self
  302.     {
  303.         if (!$this->statusTrackings->contains($statusTracking)) {
  304.             $this->statusTrackings->add($statusTracking);
  305.             $statusTracking->setShippingVehicle($this);
  306.         }
  307.         return $this;
  308.     }
  309.     public function removeStatusTracking(StatusTrackingVehicle $statusTracking): self
  310.     {
  311.         if ($this->statusTrackings->removeElement($statusTracking)) {
  312.             // set the owning side to null (unless already changed)
  313.             if ($statusTracking->getShippingVehicle() === $this) {
  314.                 $statusTracking->setShippingVehicle(null);
  315.             }
  316.         }
  317.         return $this;
  318.     }
  319.     /**
  320.      * @return Collection<int, VehicleConsumption>
  321.      */
  322.     public function getVehicleConsumptions(): Collection
  323.     {
  324.         return $this->vehicleConsumptions;
  325.     }
  326.     public function addVehicleConsumption(VehicleConsumption $vehicleConsumption): self
  327.     {
  328.         if (!$this->vehicleConsumptions->contains($vehicleConsumption)) {
  329.             $this->vehicleConsumptions->add($vehicleConsumption);
  330.             $vehicleConsumption->setShippingVehicle($this);
  331.         }
  332.         return $this;
  333.     }
  334.     public function removeVehicleConsumption(VehicleConsumption $vehicleConsumption): self
  335.     {
  336.         if ($this->vehicleConsumptions->removeElement($vehicleConsumption)) {
  337.             // set the owning side to null (unless already changed)
  338.             if ($vehicleConsumption->getShippingVehicle() === $this) {
  339.                 $vehicleConsumption->setShippingVehicle(null);
  340.             }
  341.         }
  342.         return $this;
  343.     }
  344.     /**
  345.      * @return Collection<int, VehicleRepair>
  346.      */
  347.     public function getVehicleRepairs(): Collection
  348.     {
  349.         return $this->vehicleRepairs;
  350.     }
  351.     public function addVehicleRepair(VehicleRepair $vehicleRepair): self
  352.     {
  353.         if (!$this->vehicleRepairs->contains($vehicleRepair)) {
  354.             $this->vehicleRepairs->add($vehicleRepair);
  355.             $vehicleRepair->setShippingVehicle($this);
  356.         }
  357.         return $this;
  358.     }
  359.     public function removeVehicleRepair(VehicleRepair $vehicleRepair): self
  360.     {
  361.         if ($this->vehicleRepairs->removeElement($vehicleRepair)) {
  362.             // set the owning side to null (unless already changed)
  363.             if ($vehicleRepair->getShippingVehicle() === $this) {
  364.                 $vehicleRepair->setShippingVehicle(null);
  365.             }
  366.         }
  367.         return $this;
  368.     }
  369.     public function getFuelType(): ?FuelType
  370.     {
  371.         return $this->fuelType;
  372.     }
  373.     public function setFuelType(?FuelType $fuelType): self
  374.     {
  375.         $this->fuelType $fuelType;
  376.         return $this;
  377.     }
  378.     /**
  379.      * @return Collection<int, EquipmentVehicle>
  380.      */
  381.     public function getEquipments(): Collection
  382.     {
  383.         return $this->equipments;
  384.     }
  385.     public function addEquipment(EquipmentVehicle $equipment): self
  386.     {
  387.         if (!$this->equipments->contains($equipment)) {
  388.             $this->equipments->add($equipment);
  389.         }
  390.         return $this;
  391.     }
  392.     public function removeEquipment(EquipmentVehicle $equipment): self
  393.     {
  394.         $this->equipments->removeElement($equipment);
  395.         return $this;
  396.     }
  397.     public function getBrandName(): ?string
  398.     {
  399.         return $this->brandName;
  400.     }
  401.     public function setBrandName(?string $brandName): self
  402.     {
  403.         $this->brandName $brandName;
  404.         return $this;
  405.     }
  406.     /**
  407.      * @return Collection<int, VehicleRent>
  408.      */
  409.     public function getVehicleRents(): Collection
  410.     {
  411.         return $this->vehicleRents;
  412.     }
  413.     public function addVehicleRent(VehicleRent $vehicleRent): self
  414.     {
  415.         if (!$this->vehicleRents->contains($vehicleRent)) {
  416.             $this->vehicleRents->add($vehicleRent);
  417.             $vehicleRent->setVehicle($this);
  418.         }
  419.         return $this;
  420.     }
  421.     public function removeVehicleRent(VehicleRent $vehicleRent): self
  422.     {
  423.         if ($this->vehicleRents->removeElement($vehicleRent)) {
  424.             // set the owning side to null (unless already changed)
  425.             if ($vehicleRent->getVehicle() === $this) {
  426.                 $vehicleRent->setVehicle(null);
  427.             }
  428.         }
  429.         return $this;
  430.     }
  431.     public function getVehicleRentType(): ?VehicleRentType
  432.     {
  433.         return $this->vehicleRentType;
  434.     }
  435.     public function setVehicleRentType(?VehicleRentType $vehicleRentType): self
  436.     {
  437.         $this->vehicleRentType $vehicleRentType;
  438.         return $this;
  439.     }
  440.     /**
  441.      * @return Collection<int, BodyCondition>
  442.      */
  443.     public function getBodyConditions(): Collection
  444.     {
  445.         return $this->bodyConditions;
  446.     }
  447.     public function addBodyCondition(BodyCondition $bodyCondition): self
  448.     {
  449.         if (!$this->bodyConditions->contains($bodyCondition)) {
  450.             $this->bodyConditions->add($bodyCondition);
  451.             $bodyCondition->setShippingVehicle($this);
  452.         }
  453.         return $this;
  454.     }
  455.     public function removeBodyCondition(BodyCondition $bodyCondition): self
  456.     {
  457.         if ($this->bodyConditions->removeElement($bodyCondition)) {
  458.             // set the owning side to null (unless already changed)
  459.             if ($bodyCondition->getShippingVehicle() === $this) {
  460.                 $bodyCondition->setShippingVehicle(null);
  461.             }
  462.         }
  463.         return $this;
  464.     }
  465.     /**
  466.      * @return Collection<int, OilMaintenance>
  467.      */
  468.     public function getOilMaintenances(): Collection
  469.     {
  470.         return $this->oilMaintenances;
  471.     }
  472.     public function addOilMaintenance(OilMaintenance $oilMaintenance): self
  473.     {
  474.         if (!$this->oilMaintenances->contains($oilMaintenance)) {
  475.             $this->oilMaintenances->add($oilMaintenance);
  476.             $oilMaintenance->setShippingVehicle($this);
  477.         }
  478.         return $this;
  479.     }
  480.     public function removeOilMaintenance(OilMaintenance $oilMaintenance): self
  481.     {
  482.         if ($this->oilMaintenances->removeElement($oilMaintenance)) {
  483.             // set the owning side to null (unless already changed)
  484.             if ($oilMaintenance->getShippingVehicle() === $this) {
  485.                 $oilMaintenance->setShippingVehicle(null);
  486.             }
  487.         }
  488.         return $this;
  489.     }
  490.     /**
  491.      * @return Collection<int, TechnicalControl>
  492.      */
  493.     public function getTechnicalControls(): Collection
  494.     {
  495.         return $this->technicalControls;
  496.     }
  497.     public function addTechnicalControl(TechnicalControl $technicalControl): self
  498.     {
  499.         if (!$this->technicalControls->contains($technicalControl)) {
  500.             $this->technicalControls->add($technicalControl);
  501.             $technicalControl->setShippingVehicle($this);
  502.         }
  503.         return $this;
  504.     }
  505.     public function removeTechnicalControl(TechnicalControl $technicalControl): self
  506.     {
  507.         if ($this->technicalControls->removeElement($technicalControl)) {
  508.             // set the owning side to null (unless already changed)
  509.             if ($technicalControl->getShippingVehicle() === $this) {
  510.                 $technicalControl->setShippingVehicle(null);
  511.             }
  512.         }
  513.         return $this;
  514.     }
  515.     /**
  516.      * @return Collection<int, BrakingControl>
  517.      */
  518.     public function getBrakingControls(): Collection
  519.     {
  520.         return $this->brakingControls;
  521.     }
  522.     public function addBrakingControl(BrakingControl $brakingControl): self
  523.     {
  524.         if (!$this->brakingControls->contains($brakingControl)) {
  525.             $this->brakingControls->add($brakingControl);
  526.             $brakingControl->setShippingVehicle($this);
  527.         }
  528.         return $this;
  529.     }
  530.     public function removeBrakingControl(BrakingControl $brakingControl): self
  531.     {
  532.         if ($this->brakingControls->removeElement($brakingControl)) {
  533.             // set the owning side to null (unless already changed)
  534.             if ($brakingControl->getShippingVehicle() === $this) {
  535.                 $brakingControl->setShippingVehicle(null);
  536.             }
  537.         }
  538.         return $this;
  539.     }
  540.     /**
  541.      * @return Collection<int, TireControl>
  542.      */
  543.     public function getTireControls(): Collection
  544.     {
  545.         return $this->tireControls;
  546.     }
  547.     public function addTireControl(TireControl $tireControl): self
  548.     {
  549.         if (!$this->tireControls->contains($tireControl)) {
  550.             $this->tireControls->add($tireControl);
  551.             $tireControl->setShippingVehicle($this);
  552.         }
  553.         return $this;
  554.     }
  555.     public function removeTireControl(TireControl $tireControl): self
  556.     {
  557.         if ($this->tireControls->removeElement($tireControl)) {
  558.             // set the owning side to null (unless already changed)
  559.             if ($tireControl->getShippingVehicle() === $this) {
  560.                 $tireControl->setShippingVehicle(null);
  561.             }
  562.         }
  563.         return $this;
  564.     }
  565.     /**
  566.      * @return Collection<int, DisplayControl>
  567.      */
  568.     public function getDisplayControls(): Collection
  569.     {
  570.         return $this->displayControls;
  571.     }
  572.     public function addDisplayControl(DisplayControl $displayControl): self
  573.     {
  574.         if (!$this->displayControls->contains($displayControl)) {
  575.             $this->displayControls->add($displayControl);
  576.             $displayControl->setShippingVehicle($this);
  577.         }
  578.         return $this;
  579.     }
  580.     public function removeDisplayControl(DisplayControl $displayControl): self
  581.     {
  582.         if ($this->displayControls->removeElement($displayControl)) {
  583.             // set the owning side to null (unless already changed)
  584.             if ($displayControl->getShippingVehicle() === $this) {
  585.                 $displayControl->setShippingVehicle(null);
  586.             }
  587.         }
  588.         return $this;
  589.     }
  590.     /**
  591.      * @return Collection<int, PowerControl>
  592.      */
  593.     public function getPowerControls(): Collection
  594.     {
  595.         return $this->powerControls;
  596.     }
  597.     public function addPowerControl(PowerControl $powerControl): self
  598.     {
  599.         if (!$this->powerControls->contains($powerControl)) {
  600.             $this->powerControls->add($powerControl);
  601.             $powerControl->setShippingVehicle($this);
  602.         }
  603.         return $this;
  604.     }
  605.     public function removePowerControl(PowerControl $powerControl): self
  606.     {
  607.         if ($this->powerControls->removeElement($powerControl)) {
  608.             // set the owning side to null (unless already changed)
  609.             if ($powerControl->getShippingVehicle() === $this) {
  610.                 $powerControl->setShippingVehicle(null);
  611.             }
  612.         }
  613.         return $this;
  614.     }
  615.     /**
  616.      * @return Collection<int, OtherControl>
  617.      */
  618.     public function getOtherControls(): Collection
  619.     {
  620.         return $this->otherControls;
  621.     }
  622.     public function addOtherControl(OtherControl $otherControl): self
  623.     {
  624.         if (!$this->otherControls->contains($otherControl)) {
  625.             $this->otherControls->add($otherControl);
  626.             $otherControl->setShippingVehicle($this);
  627.         }
  628.         return $this;
  629.     }
  630.     public function removeOtherControl(OtherControl $otherControl): self
  631.     {
  632.         if ($this->otherControls->removeElement($otherControl)) {
  633.             // set the owning side to null (unless already changed)
  634.             if ($otherControl->getShippingVehicle() === $this) {
  635.                 $otherControl->setShippingVehicle(null);
  636.             }
  637.         }
  638.         return $this;
  639.     }
  640. }