src/Entity/DocumentDriver.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\TimestampableTrait;
  4. use App\Repository\DocumentDriverRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=DocumentDriverRepository::class)
  10.  */
  11. class DocumentDriver
  12. {
  13.     use TimestampableTrait;
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @ORM\Column(type="string", length=255)
  26.      */
  27.     private $company;
  28.     /**
  29.      * @ORM\Column(type="string", length=255)
  30.      */
  31.     private $pvNumber;
  32.     /**
  33.      * @ORM\Column(type="date")
  34.      */
  35.     private $date;
  36.     /**
  37.      * @ORM\Column(type="date", nullable=true)
  38.      */
  39.     private $nextDate;
  40.     /**
  41.      * @ORM\Column(type="text", nullable=true)
  42.      */
  43.     private $infos;
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity=Transporteur::class, inversedBy="documentDrivers")
  46.      */
  47.     private $transporteur;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=Vehicle::class, inversedBy="documentDrivers")
  50.      */
  51.     private $vehicle;
  52.     /**
  53.      * @ORM\OneToMany(targetEntity=Attachment::class, mappedBy="documentDriver", orphanRemoval=true, cascade={"persist"})
  54.      */
  55.     private $attachments;
  56.     public function __construct()
  57.     {
  58.         $this->attachments = new ArrayCollection();
  59.     }
  60.     public function getId(): ?int
  61.     {
  62.         return $this->id;
  63.     }
  64.     public function getName(): ?string
  65.     {
  66.         return $this->name;
  67.     }
  68.     public function setName(string $name): self
  69.     {
  70.         $this->name $name;
  71.         return $this;
  72.     }
  73.     public function getCompany(): ?string
  74.     {
  75.         return $this->company;
  76.     }
  77.     public function setCompany(string $company): self
  78.     {
  79.         $this->company $company;
  80.         return $this;
  81.     }
  82.     public function getPvNumber(): ?string
  83.     {
  84.         return $this->pvNumber;
  85.     }
  86.     public function setPvNumber(string $pvNumber): self
  87.     {
  88.         $this->pvNumber $pvNumber;
  89.         return $this;
  90.     }
  91.     public function getDate(): ?\DateTimeInterface
  92.     {
  93.         return $this->date;
  94.     }
  95.     public function setDate(\DateTimeInterface $date): self
  96.     {
  97.         $this->date $date;
  98.         return $this;
  99.     }
  100.     public function getNextDate(): ?\DateTimeInterface
  101.     {
  102.         return $this->nextDate;
  103.     }
  104.     public function setNextDate(?\DateTimeInterface $nextDate): self
  105.     {
  106.         $this->nextDate $nextDate;
  107.         return $this;
  108.     }
  109.     public function getInfos(): ?string
  110.     {
  111.         return $this->infos;
  112.     }
  113.     public function setInfos(?string $infos): self
  114.     {
  115.         $this->infos $infos;
  116.         return $this;
  117.     }
  118.     public function getTransporteur(): ?Transporteur
  119.     {
  120.         return $this->transporteur;
  121.     }
  122.     public function setTransporteur(?Transporteur $transporteur): self
  123.     {
  124.         $this->transporteur $transporteur;
  125.         return $this;
  126.     }
  127.     public function getVehicle(): ?Vehicle
  128.     {
  129.         return $this->vehicle;
  130.     }
  131.     public function setVehicle(?Vehicle $vehicle): self
  132.     {
  133.         $this->vehicle $vehicle;
  134.         return $this;
  135.     }
  136.     /**
  137.      * @return Collection<int, Attachment>
  138.      */
  139.     public function getAttachments(): Collection
  140.     {
  141.         return $this->attachments;
  142.     }
  143.     public function addAttahcment(Attachment $attahcment): self
  144.     {
  145.         if (!$this->attachments->contains($attahcment)) {
  146.             $this->attachments[] = $attahcment;
  147.             $attahcment->setDocumentDriver($this);
  148.         }
  149.         return $this;
  150.     }
  151.     public function removeAttahcment(Attachment $attahcment): self
  152.     {
  153.         if ($this->attachments->removeElement($attahcment)) {
  154.             // set the owning side to null (unless already changed)
  155.             if ($attahcment->getDocumentDriver() === $this) {
  156.                 $attahcment->setDocumentDriver(null);
  157.             }
  158.         }
  159.         return $this;
  160.     }
  161.     public function addAttachment(Attachment $attachment): self
  162.     {
  163.         if (!$this->attachments->contains($attachment)) {
  164.             $this->attachments[] = $attachment;
  165.             $attachment->setDocumentDriver($this);
  166.         }
  167.         return $this;
  168.     }
  169.     public function removeAttachment(Attachment $attachment): self
  170.     {
  171.         if ($this->attachments->removeElement($attachment)) {
  172.             // set the owning side to null (unless already changed)
  173.             if ($attachment->getDocumentDriver() === $this) {
  174.                 $attachment->setDocumentDriver(null);
  175.             }
  176.         }
  177.         return $this;
  178.     }
  179. }