<?php
namespace App\Entity;
use App\Entity\TimestampableTrait;
use App\Repository\DocumentDriverRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=DocumentDriverRepository::class)
*/
class DocumentDriver
{
use TimestampableTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $company;
/**
* @ORM\Column(type="string", length=255)
*/
private $pvNumber;
/**
* @ORM\Column(type="date")
*/
private $date;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $nextDate;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $infos;
/**
* @ORM\ManyToOne(targetEntity=Transporteur::class, inversedBy="documentDrivers")
*/
private $transporteur;
/**
* @ORM\ManyToOne(targetEntity=Vehicle::class, inversedBy="documentDrivers")
*/
private $vehicle;
/**
* @ORM\OneToMany(targetEntity=Attachment::class, mappedBy="documentDriver", orphanRemoval=true, cascade={"persist"})
*/
private $attachments;
public function __construct()
{
$this->attachments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getCompany(): ?string
{
return $this->company;
}
public function setCompany(string $company): self
{
$this->company = $company;
return $this;
}
public function getPvNumber(): ?string
{
return $this->pvNumber;
}
public function setPvNumber(string $pvNumber): self
{
$this->pvNumber = $pvNumber;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getNextDate(): ?\DateTimeInterface
{
return $this->nextDate;
}
public function setNextDate(?\DateTimeInterface $nextDate): self
{
$this->nextDate = $nextDate;
return $this;
}
public function getInfos(): ?string
{
return $this->infos;
}
public function setInfos(?string $infos): self
{
$this->infos = $infos;
return $this;
}
public function getTransporteur(): ?Transporteur
{
return $this->transporteur;
}
public function setTransporteur(?Transporteur $transporteur): self
{
$this->transporteur = $transporteur;
return $this;
}
public function getVehicle(): ?Vehicle
{
return $this->vehicle;
}
public function setVehicle(?Vehicle $vehicle): self
{
$this->vehicle = $vehicle;
return $this;
}
/**
* @return Collection<int, Attachment>
*/
public function getAttachments(): Collection
{
return $this->attachments;
}
public function addAttahcment(Attachment $attahcment): self
{
if (!$this->attachments->contains($attahcment)) {
$this->attachments[] = $attahcment;
$attahcment->setDocumentDriver($this);
}
return $this;
}
public function removeAttahcment(Attachment $attahcment): self
{
if ($this->attachments->removeElement($attahcment)) {
// set the owning side to null (unless already changed)
if ($attahcment->getDocumentDriver() === $this) {
$attahcment->setDocumentDriver(null);
}
}
return $this;
}
public function addAttachment(Attachment $attachment): self
{
if (!$this->attachments->contains($attachment)) {
$this->attachments[] = $attachment;
$attachment->setDocumentDriver($this);
}
return $this;
}
public function removeAttachment(Attachment $attachment): self
{
if ($this->attachments->removeElement($attachment)) {
// set the owning side to null (unless already changed)
if ($attachment->getDocumentDriver() === $this) {
$attachment->setDocumentDriver(null);
}
}
return $this;
}
}