src/Flexy/ShopBundle/Entity/Shipping/Vehicle/VehicleIncident.php line 16

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Shipping\Vehicle;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Entity\Image;
  5. use App\Flexy\ShopBundle\Entity\Accounting\PayableInvoice;
  6. use App\Repository\Flexy\ShopBundle\Entity\Shipping\VehicleIncidentRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. #[ORM\Entity(repositoryClassVehicleIncidentRepository::class)]
  12. #[ApiResource]
  13. class VehicleIncident
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  20.     private ?\DateTimeInterface $createdAt null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $faultType null;
  23.     #[ORM\Column(nullabletrue)]
  24.     private ?bool $filedReport null;
  25.     #[ORM\Column(length255nullabletrue)]
  26.     private ?string $reporterName null;
  27.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  28.     private ?\DateTimeInterface $reportFiledAt null;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $incidentType null;
  31.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  32.     private ?string $description null;
  33.     #[ORM\ManyToOne(inversedBy'vehicleIncidents',cascade: ['persist'])]
  34.     private ?ShippingVehicle $shippingVehicle null;
  35.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  36.     private ?PayableInvoice $payableInvoice null;
  37.     #[ORM\ManyToMany(targetEntityImage::class,cascade: ['persist''remove'])]
  38.     private Collection $images;
  39.     #[ORM\Column(length255nullabletrue)]
  40.     private ?string $imageReport null;
  41.     public function __toString()
  42.     {
  43.         $formattedDate "";
  44.         if($this->reportFiledAt){
  45.             $formattedDate " le ".$this->reportFiledAt->format("m/d/Y H:i");
  46.         }
  47.         return (string)$this->incidentType.$formattedDate;
  48.     }
  49.     public function __construct()
  50.     {
  51.         $this->images = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getCreatedAt(): ?\DateTimeInterface
  58.     {
  59.         return $this->createdAt;
  60.     }
  61.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  62.     {
  63.         $this->createdAt $createdAt;
  64.         return $this;
  65.     }
  66.     public function getFaultType(): ?string
  67.     {
  68.         return $this->faultType;
  69.     }
  70.     public function setFaultType(?string $faultType): self
  71.     {
  72.         $this->faultType $faultType;
  73.         return $this;
  74.     }
  75.     public function isFiledReport(): ?bool
  76.     {
  77.         return $this->filedReport;
  78.     }
  79.     public function setFiledReport(?bool $filedReport): self
  80.     {
  81.         $this->filedReport $filedReport;
  82.         return $this;
  83.     }
  84.     public function getReporterName(): ?string
  85.     {
  86.         return $this->reporterName;
  87.     }
  88.     public function setReporterName(?string $reporterName): self
  89.     {
  90.         $this->reporterName $reporterName;
  91.         return $this;
  92.     }
  93.     public function getReportFiledAt(): ?\DateTimeInterface
  94.     {
  95.         return $this->reportFiledAt;
  96.     }
  97.     public function setReportFiledAt(?\DateTimeInterface $reportFiledAt): self
  98.     {
  99.         $this->reportFiledAt $reportFiledAt;
  100.         return $this;
  101.     }
  102.     public function getIncidentType(): ?string
  103.     {
  104.         return $this->incidentType;
  105.     }
  106.     public function setIncidentType(?string $incidentType): self
  107.     {
  108.         $this->incidentType $incidentType;
  109.         return $this;
  110.     }
  111.     public function getDescription(): ?string
  112.     {
  113.         return $this->description;
  114.     }
  115.     public function setDescription(?string $description): self
  116.     {
  117.         $this->description $description;
  118.         return $this;
  119.     }
  120.     public function getShippingVehicle(): ?ShippingVehicle
  121.     {
  122.         return $this->shippingVehicle;
  123.     }
  124.     public function setShippingVehicle(?ShippingVehicle $shippingVehicle): self
  125.     {
  126.         $this->shippingVehicle $shippingVehicle;
  127.         return $this;
  128.     }
  129.     public function getPayableInvoice(): ?PayableInvoice
  130.     {
  131.         return $this->payableInvoice;
  132.     }
  133.     public function setPayableInvoice(?PayableInvoice $payableInvoice): self
  134.     {
  135.         $this->payableInvoice $payableInvoice;
  136.         return $this;
  137.     }
  138.     /**
  139.      * @return Collection<int, Image>
  140.      */
  141.     public function getImages(): Collection
  142.     {
  143.         return $this->images;
  144.     }
  145.     public function addImage(Image $image): self
  146.     {
  147.         if (!$this->images->contains($image)) {
  148.             $this->images->add($image);
  149.         }
  150.         return $this;
  151.     }
  152.     public function removeImage(Image $image): self
  153.     {
  154.         $this->images->removeElement($image);
  155.         return $this;
  156.     }
  157.     public function getImageReport(): ?string
  158.     {
  159.         return $this->imageReport;
  160.     }
  161.     public function setImageReport(?string $imageReport): self
  162.     {
  163.         $this->imageReport $imageReport;
  164.         return $this;
  165.     }
  166. }