src/Entity/Devis.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DevisRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Entity\TimestampableTrait;
  8. /**
  9.  * @ORM\Entity(repositoryClass=DevisRepository::class)
  10.  */
  11. class Devis
  12. {
  13.     public const STATUS_PENDING 'pending';
  14.     public const STATUS_VALIDATED 'validated';
  15.     public const STATUS_REJECTED 'rejected';
  16.     use TimestampableTrait;
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $typeOfTrip;
  27.     /**
  28.      * @ORM\Column(type="string", length=255)
  29.      */
  30.     private $departureAddress;
  31.     /**
  32.      * @ORM\Column(type="string", length=255, nullable=true)
  33.      */
  34.     private $arrivalAddress;
  35.     /**
  36.      * @ORM\Column(type="date", nullable=true)
  37.      */
  38.     private $departureDate;
  39.     /**
  40.      * @ORM\Column(type="time", nullable=true)
  41.      */
  42.     private $departureTime;
  43.     /**
  44.      * @ORM\Column(type="date", nullable=true)
  45.      */
  46.     private $returnDate;
  47.     /**
  48.      * @ORM\Column(type="time", nullable=true)
  49.      */
  50.     private $returnTime;
  51.     /**
  52.      * @ORM\Column(type="integer", nullable=true)
  53.      */
  54.     private $numberOfPeople;
  55.     /**
  56.      * @ORM\Column(type="string", length=50)
  57.      */
  58.     private $status self::STATUS_PENDING;
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity=Service::class, inversedBy="devis")
  61.      * @ORM\JoinColumn(nullable=false)
  62.      */
  63.     private $service;
  64.     /**
  65.      * @ORM\Column(type="string", length=255, nullable=true)
  66.      */
  67.     private $distance;
  68.     /**
  69.      * @ORM\Column(type="float", nullable=true)
  70.      */
  71.     private $startLatitude;
  72.     /**
  73.      * @ORM\Column(type="float", nullable=true)
  74.      */
  75.     private $startLongitude;
  76.     /**
  77.      * @ORM\Column(type="float", nullable=true)
  78.      */
  79.     private $endLatitude;
  80.     /**
  81.      * @ORM\Column(type="float", nullable=true)
  82.      */
  83.     private $endLongitude;
  84.     /**
  85.      * @ORM\ManyToOne(targetEntity=DevisLuggage::class, inversedBy="devis")
  86.      */
  87.     private $devisLuggage;
  88.     /**
  89.      * @ORM\ManyToOne(targetEntity=DevisTravelReason::class, inversedBy="devis")
  90.      * @ORM\JoinColumn(nullable=false)
  91.      */
  92.     private $devisTravelReason;
  93.     /**
  94.      * @ORM\ManyToOne(targetEntity=DevisBudget::class, inversedBy="devis")
  95.      * @ORM\JoinColumn(nullable=false)
  96.      */
  97.     private $devisBudget;
  98.     /**
  99.      * @ORM\ManyToMany(targetEntity=DevisEquipment::class, inversedBy="devis")
  100.      * @ORM\JoinTable(name="devis_equipment_devis")
  101.      */
  102.     private $devisEquipment;
  103.     /**
  104.      * @ORM\Column(type="text", nullable=true)
  105.      */
  106.     private $infos;
  107.     /**
  108.      * @ORM\Column(type="string", nullable=true)
  109.      */
  110.     private $needVehicleOnSite;
  111.     /**
  112.      * @ORM\OneToMany(targetEntity=DevisVehicleDetails::class, mappedBy="devis", cascade={"persist", "remove"}, orphanRemoval=true)
  113.      */
  114.     private $vehicleDetails;
  115.     /**
  116.      * @ORM\Column(type="string", length=255, nullable=true)
  117.      */
  118.     private $addPdfDocument;
  119.     /**
  120.      * @ORM\OneToMany(targetEntity=DevisAttachment::class, mappedBy="devis", cascade={"persist", "remove"}, orphanRemoval=true)
  121.      */
  122.     private $attachments;
  123.     /**
  124.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="devis")
  125.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  126.      */
  127.     private $user;
  128.     /**
  129.      * @ORM\Column(type="string", length=255, nullable=true)
  130.      */
  131.     private $distancePerTrip;
  132.     /**
  133.      * @ORM\Column(type="boolean")
  134.      */
  135.     private $miseEnAvance false;
  136.     /**
  137.      * @ORM\Column(type="boolean")
  138.      */
  139.     private $remonteEnTeteDeListe false;
  140.     /**
  141.      * @ORM\Column(type="boolean")
  142.      */
  143.     private $demandeUrgente false;
  144.     public function __construct()
  145.     {
  146.         $this->devisEquipment = new ArrayCollection();
  147.         $this->vehicleDetails = new ArrayCollection();
  148.         $this->attachments = new ArrayCollection();
  149.     }
  150.     public function getId(): ?int
  151.     {
  152.         return $this->id;
  153.     }
  154.     public function getTypeOfTrip(): ?string
  155.     {
  156.         return $this->typeOfTrip;
  157.     }
  158.     public function setTypeOfTrip(string $typeOfTrip): self
  159.     {
  160.         $this->typeOfTrip $typeOfTrip;
  161.         return $this;
  162.     }
  163.     public function getDepartureAddress(): ?string
  164.     {
  165.         return $this->departureAddress;
  166.     }
  167.     public function setDepartureAddress(string $departureAddress): self
  168.     {
  169.         $this->departureAddress $departureAddress;
  170.         return $this;
  171.     }
  172.     public function getArrivalAddress(): ?string
  173.     {
  174.         return $this->arrivalAddress;
  175.     }
  176.     public function setArrivalAddress(?string $arrivalAddress): self
  177.     {
  178.         $this->arrivalAddress $arrivalAddress;
  179.         return $this;
  180.     }
  181.     public function getDepartureDate(): ?\DateTimeInterface
  182.     {
  183.         return $this->departureDate;
  184.     }
  185.     public function setDepartureDate(?\DateTimeInterface $departureDate): self
  186.     {
  187.         $this->departureDate $departureDate;
  188.         return $this;
  189.     }
  190.     public function getDepartureTime(): ?\DateTimeInterface
  191.     {
  192.         return $this->departureTime;
  193.     }
  194.     public function setDepartureTime(?\DateTimeInterface $departureTime): self
  195.     {
  196.         $this->departureTime $departureTime;
  197.         return $this;
  198.     }
  199.     public function getReturnDate(): ?\DateTimeInterface
  200.     {
  201.         return $this->returnDate;
  202.     }
  203.     public function setReturnDate(?\DateTimeInterface $returnDate): self
  204.     {
  205.         $this->returnDate $returnDate;
  206.         return $this;
  207.     }
  208.     public function getReturnTime(): ?\DateTimeInterface
  209.     {
  210.         return $this->returnTime;
  211.     }
  212.     public function setReturnTime(?\DateTimeInterface $returnTime): self
  213.     {
  214.         $this->returnTime $returnTime;
  215.         return $this;
  216.     }
  217.     public function getNumberOfPeople(): ?int
  218.     {
  219.         return $this->numberOfPeople;
  220.     }
  221.     public function setNumberOfPeople(?int $numberOfPeople): self
  222.     {
  223.         $this->numberOfPeople $numberOfPeople;
  224.         return $this;
  225.     }
  226.     public function isStatus(): ?string
  227.     {
  228.         return $this->status;
  229.     }
  230.     public function setStatus(string $status): self
  231.     {
  232.         $this->status $status;
  233.         return $this;
  234.     }
  235.     public function getService(): ?Service
  236.     {
  237.         return $this->service;
  238.     }
  239.     public function setService(?Service $service): self
  240.     {
  241.         $this->service $service;
  242.         return $this;
  243.     }
  244.     public function getDistance(): ?string
  245.     {
  246.         return $this->distance;
  247.     }
  248.     public function setDistance(?string $distance): self
  249.     {
  250.         $this->distance $distance;
  251.         return $this;
  252.     }
  253.     public function getStartLatitude(): ?float
  254.     {
  255.         return $this->startLatitude;
  256.     }
  257.     public function setStartLatitude(?float $startLatitude): self
  258.     {
  259.         $this->startLatitude $startLatitude;
  260.         return $this;
  261.     }
  262.     public function getStartLongitude(): ?float
  263.     {
  264.         return $this->startLongitude;
  265.     }
  266.     public function setStartLongitude(?float $startLongitude): self
  267.     {
  268.         $this->startLongitude $startLongitude;
  269.         return $this;
  270.     }
  271.     public function getEndLatitude(): ?float
  272.     {
  273.         return $this->endLatitude;
  274.     }
  275.     public function setEndLatitude(?float $endLatitude): self
  276.     {
  277.         $this->endLatitude $endLatitude;
  278.         return $this;
  279.     }
  280.     public function getEndLongitude(): ?float
  281.     {
  282.         return $this->endLongitude;
  283.     }
  284.     public function setEndLongitude(?float $endLongitude): self
  285.     {
  286.         $this->endLongitude $endLongitude;
  287.         return $this;
  288.     }
  289.     public function getDevisLuggage(): ?DevisLuggage
  290.     {
  291.         return $this->devisLuggage;
  292.     }
  293.     public function setDevisLuggage(?DevisLuggage $devisLuggage): self
  294.     {
  295.         $this->devisLuggage $devisLuggage;
  296.         return $this;
  297.     }
  298.     public function getDevisTravelReason(): ?DevisTravelReason
  299.     {
  300.         return $this->devisTravelReason;
  301.     }
  302.     public function setDevisTravelReason(?DevisTravelReason $devisTravelReason): self
  303.     {
  304.         $this->devisTravelReason $devisTravelReason;
  305.         return $this;
  306.     }
  307.     public function getDevisBudget(): ?DevisBudget
  308.     {
  309.         return $this->devisBudget;
  310.     }
  311.     public function setDevisBudget(?DevisBudget $devisBudget): self
  312.     {
  313.         $this->devisBudget $devisBudget;
  314.         return $this;
  315.     }
  316.     /**
  317.      * @return Collection<int, DevisEquipment>
  318.      */
  319.     public function getDevisEquipment(): Collection
  320.     {
  321.         return $this->devisEquipment;
  322.     }
  323.     public function addDevisEquipment(DevisEquipment $devisEquipment): self
  324.     {
  325.         if (!$this->devisEquipment->contains($devisEquipment)) {
  326.             $this->devisEquipment[] = $devisEquipment;
  327.             $devisEquipment->addDevi($this);
  328.         }
  329.         return $this;
  330.     }
  331.     public function removeDevisEquipment(DevisEquipment $devisEquipment): self
  332.     {
  333.         $this->devisEquipment->removeElement($devisEquipment);
  334.         return $this;
  335.     }
  336.     public function setDevisEquipment(array $equipments): self
  337.     {
  338.         foreach ($this->devisEquipment as $existingEquipment) {
  339.             $this->removeDevisEquipment($existingEquipment);
  340.         }
  341.         foreach ($equipments as $equipment) {
  342.             $this->addDevisEquipment($equipment);
  343.         }
  344.         return $this;
  345.     }
  346.     public function getInfos(): ?string
  347.     {
  348.         return $this->infos;
  349.     }
  350.     public function setInfos(?string $infos): self
  351.     {
  352.         $this->infos $infos;
  353.         return $this;
  354.     }
  355.     public function getNeedVehicleOnSite(): ?string
  356.     {
  357.         return $this->needVehicleOnSite;
  358.     }
  359.     public function setNeedVehicleOnSite(?string $needVehicleOnSite): self
  360.     {
  361.         $this->needVehicleOnSite $needVehicleOnSite;
  362.         return $this;
  363.     }
  364.     /**
  365.      * @return Collection<int, DevisVehicleDetails>
  366.      */
  367.     public function getVehicleDetails(): Collection
  368.     {
  369.         return $this->vehicleDetails;
  370.     }
  371.     public function addVehicleDetail(DevisVehicleDetails $vehicleDetail): self
  372.     {
  373.         if (!$this->vehicleDetails->contains($vehicleDetail)) {
  374.             $this->vehicleDetails[] = $vehicleDetail;
  375.             $vehicleDetail->setDevis($this);
  376.         }
  377.         return $this;
  378.     }
  379.     public function removeVehicleDetail(DevisVehicleDetails $vehicleDetail): self
  380.     {
  381.         if ($this->vehicleDetails->removeElement($vehicleDetail)) {
  382.             // set the owning side to null (unless already changed)
  383.             if ($vehicleDetail->getDevis() === $this) {
  384.                 $vehicleDetail->setDevis(null);
  385.             }
  386.         }
  387.         return $this;
  388.     }
  389.     public function getAddPdfDocument(): ?string
  390.     {
  391.         return $this->addPdfDocument;
  392.     }
  393.     public function setAddPdfDocument(?string $addPdfDocument): self
  394.     {
  395.         $this->addPdfDocument $addPdfDocument;
  396.         return $this;
  397.     }
  398.     /**
  399.      * @return Collection<int, DevisAttachment>
  400.      */
  401.     public function getAttachments(): Collection
  402.     {
  403.         return $this->attachments;
  404.     }
  405.     public function addAttachment(DevisAttachment $attachment): self
  406.     {
  407.         if (!$this->attachments->contains($attachment)) {
  408.             $this->attachments[] = $attachment;
  409.             $attachment->setDevis($this);
  410.         }
  411.         return $this;
  412.     }
  413.     public function removeAttachment(DevisAttachment $attachment): self
  414.     {
  415.         if ($this->attachments->removeElement($attachment)) {
  416.             // set the owning side to null (unless already changed)
  417.             if ($attachment->getDevis() === $this) {
  418.                 $attachment->setDevis(null);
  419.             }
  420.         }
  421.         return $this;
  422.     }
  423.     public function getUser(): ?User
  424.     {
  425.         return $this->user;
  426.     }
  427.     public function setUser(?User $user): self
  428.     {
  429.         $this->user $user;
  430.         return $this;
  431.     }
  432.     public function getDistancePerTrip(): ?string
  433.     {
  434.         return $this->distancePerTrip;
  435.     }
  436.     public function setDistancePerTrip(?string $distancePerTrip): self
  437.     {
  438.         $this->distancePerTrip $distancePerTrip;
  439.         return $this;
  440.     }
  441.     public function isMiseEnAvance(): ?bool
  442.     {
  443.         return $this->miseEnAvance;
  444.     }
  445.     public function setMiseEnAvance(bool $miseEnAvance): self
  446.     {
  447.         $this->miseEnAvance $miseEnAvance;
  448.         return $this;
  449.     }
  450.     public function isRemonteEnTeteDeListe(): ?bool
  451.     {
  452.         return $this->remonteEnTeteDeListe;
  453.     }
  454.     public function setRemonteEnTeteDeListe(bool $remonteEnTeteDeListe): self
  455.     {
  456.         $this->remonteEnTeteDeListe $remonteEnTeteDeListe;
  457.         return $this;
  458.     }
  459.     public function isDemandeUrgente(): ?bool
  460.     {
  461.         return $this->demandeUrgente;
  462.     }
  463.     public function setDemandeUrgente(bool $demandeUrgente): self
  464.     {
  465.         $this->demandeUrgente $demandeUrgente;
  466.         return $this;
  467.     }
  468.     public function getStatus(): ?string
  469.     {
  470.         return $this->status;
  471.     }
  472. }