src/Flexy/ShopBundle/Entity/Shipping/Vehicle/VehicleIncident.php line 16
<?php
namespace App\Flexy\ShopBundle\Entity\Shipping\Vehicle;
use ApiPlatform\Metadata\ApiResource;
use App\Entity\Image;
use App\Flexy\ShopBundle\Entity\Accounting\PayableInvoice;
use App\Repository\Flexy\ShopBundle\Entity\Shipping\VehicleIncidentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: VehicleIncidentRepository::class)]
#[ApiResource]
class VehicleIncident
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $faultType = null;
#[ORM\Column(nullable: true)]
private ?bool $filedReport = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $reporterName = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $reportFiledAt = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $incidentType = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\ManyToOne(inversedBy: 'vehicleIncidents',cascade: ['persist'])]
private ?ShippingVehicle $shippingVehicle = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?PayableInvoice $payableInvoice = null;
#[ORM\ManyToMany(targetEntity: Image::class,cascade: ['persist', 'remove'])]
private Collection $images;
#[ORM\Column(length: 255, nullable: true)]
private ?string $imageReport = null;
public function __toString()
{
$formattedDate = "";
if($this->reportFiledAt){
$formattedDate = " le ".$this->reportFiledAt->format("m/d/Y H:i");
}
return (string)$this->incidentType.$formattedDate;
}
public function __construct()
{
$this->images = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getFaultType(): ?string
{
return $this->faultType;
}
public function setFaultType(?string $faultType): self
{
$this->faultType = $faultType;
return $this;
}
public function isFiledReport(): ?bool
{
return $this->filedReport;
}
public function setFiledReport(?bool $filedReport): self
{
$this->filedReport = $filedReport;
return $this;
}
public function getReporterName(): ?string
{
return $this->reporterName;
}
public function setReporterName(?string $reporterName): self
{
$this->reporterName = $reporterName;
return $this;
}
public function getReportFiledAt(): ?\DateTimeInterface
{
return $this->reportFiledAt;
}
public function setReportFiledAt(?\DateTimeInterface $reportFiledAt): self
{
$this->reportFiledAt = $reportFiledAt;
return $this;
}
public function getIncidentType(): ?string
{
return $this->incidentType;
}
public function setIncidentType(?string $incidentType): self
{
$this->incidentType = $incidentType;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getShippingVehicle(): ?ShippingVehicle
{
return $this->shippingVehicle;
}
public function setShippingVehicle(?ShippingVehicle $shippingVehicle): self
{
$this->shippingVehicle = $shippingVehicle;
return $this;
}
public function getPayableInvoice(): ?PayableInvoice
{
return $this->payableInvoice;
}
public function setPayableInvoice(?PayableInvoice $payableInvoice): self
{
$this->payableInvoice = $payableInvoice;
return $this;
}
/**
* @return Collection<int, Image>
*/
public function getImages(): Collection
{
return $this->images;
}
public function addImage(Image $image): self
{
if (!$this->images->contains($image)) {
$this->images->add($image);
}
return $this;
}
public function removeImage(Image $image): self
{
$this->images->removeElement($image);
return $this;
}
public function getImageReport(): ?string
{
return $this->imageReport;
}
public function setImageReport(?string $imageReport): self
{
$this->imageReport = $imageReport;
return $this;
}
}