<?php
namespace App\Entity;
use App\Entity\TimestampableTrait;
use App\Repository\ControleTachygrapheRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ControleTachygrapheRepository::class)
*/
class ControleTachygraphe
{
use TimestampableTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Transporteur::class, inversedBy="controleTachygraphes")
*/
private $transporteur;
/**
* @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=Vehicle::class, inversedBy="controleTachygraphes")
*/
private $vehicle;
/**
* @ORM\OneToMany(targetEntity=Attachment::class, mappedBy="controleTachygraphe", orphanRemoval=true, cascade={"persist"})
*/
private $attachments;
public function __construct()
{
$this->attachments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTransporteur(): ?Transporteur
{
return $this->transporteur;
}
public function setTransporteur(?Transporteur $transporteur): self
{
$this->transporteur = $transporteur;
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 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 addAttachment(Attachment $attachment): self
{
if (!$this->attachments->contains($attachment)) {
$this->attachments[] = $attachment;
$attachment->setControleTachygraphe($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->getControleTachygraphe() === $this) {
$attachment->setControleTachygraphe(null);
}
}
return $this;
}
}