src/Flexy/Apps/TransportBundle/Entity/Mission.php line 25

  1. <?php
  2. namespace App\Flexy\Apps\TransportBundle\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Customer\CustomerGroup;
  5. use App\Flexy\ShopBundle\Entity\Order\Order;
  6. use App\Flexy\ShopBundle\Entity\Resource\Agent;
  7. use App\Flexy\ShopBundle\Entity\Shipping\Shipment;
  8. use App\Flexy\ShopBundle\Entity\Shipping\ShipmentItem;
  9. use App\Flexy\ShopBundle\Entity\Shipping\Vehicle\ShippingVehicle;
  10. use App\Flexy\ShopBundle\Entity\Shipping\Vehicle\ShippingVehicleType;
  11. use App\Flexy\Apps\TransportBundle\Repository\MissionRepository;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. use Doctrine\Common\Collections\Collection;
  14. use Doctrine\DBAL\Types\Types;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use Gedmo\Mapping\Annotation as Gedmo;
  17. use Symfony\UX\Turbo\Attribute\Broadcast;
  18. #[ORM\Entity(repositoryClassMissionRepository::class)]
  19. #[ApiResource]
  20. //#[Broadcast]
  21. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  22. class Mission implements \Stringable
  23. {
  24.     #[ORM\Id]
  25.     #[ORM\GeneratedValue]
  26.     #[ORM\Column]
  27.     private ?int $id null;
  28.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  29.     private ?\DateTimeInterface $createdAt null;
  30.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  31.     private ?string $description null;
  32.     
  33.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  34.     private ?\DateTimeInterface $datePickup null;
  35.     #[ORM\Column(typeTypes::TIME_MUTABLEnullabletrue)]
  36.     private ?\DateTimeInterface $timePickup null;
  37.     #[ORM\Column(nullabletrue)]
  38.     private ?int $nbrAdults null;
  39.     #[ORM\Column(nullabletrue)]
  40.     private ?int $nbrChildrens null;
  41.     #[ORM\Column(nullabletrue)]
  42.     private ?int $nbrBags null;
  43.     #[ORM\ManyToOne(cascade:["persist"])]
  44.     private ?Order $relatedOrder null;
  45.  
  46.     #[ORM\Column(length255nullabletrue)]
  47.     private ?string $lang null;
  48.     #[ORM\Column(length255nullabletrue)]
  49.     private ?string $type null;
  50.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  51.     private ?array $handicap null;
  52.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  53.     private array $forfait = [];
  54.     #[ORM\Column(length255nullabletrue)]
  55.     private ?string $status null;
  56.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  57.     private ?\DateTimeInterface $endMissionDate null;
  58.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  59.     private ?\DateTimeInterface $endMissionTime null;
  60.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  61.     private ?\DateTimeInterface $realPickupDate null;
  62.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  63.     private ?\DateTimeInterface $realStartMission null;
  64.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  65.     private ?\DateTimeInterface $realDeliveryDate null;
  66.     #[ORM\Column(nullabletrue)]
  67.     private ?\DateTimeImmutable $deletedAt null;
  68.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  69.     private ?Shipment $shipment null;
  70.     #[ORM\OneToMany(mappedBy'mission'targetEntityMissionExtraFees::class)]
  71.     private Collection $missionExtraFees;
  72.     #[ORM\Column(nullabletrue)]
  73.     private ?bool $departSiege null;
  74.     #[ORM\Column(nullabletrue)]
  75.     private ?bool $sharedShuttle null;
  76.     #[ORM\Column(nullabletrue)]
  77.     private ?float $price null;
  78.     #[ORM\Column(length255nullabletrue)]
  79.     private ?string $vendorCompanyName null;
  80.     #[ORM\Column(length255nullabletrue)]
  81.     private ?string $logo null;
  82.     #[ORM\ManyToOne]
  83.     private ?ShippingVehicleType $shippingVehicleType null;
  84.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  85.     private ?string $driverComment null;
  86.     #[ORM\ManyToOne]
  87.     private ?Agent $driver null;
  88.     #[ORM\Column(nullabletrue)]
  89.     private ?bool $moneyTakenByDriver null;
  90.     #[ORM\Column(length255nullabletrue)]
  91.     private ?string $acceptedByDriver null;
  92.     #[ORM\ManyToOne]
  93.     private ?CustomerGroup $customerGroup null;
  94.     #[ORM\ManyToOne]
  95.     private ?ShippingVehicle $shippingVehicle null;
  96.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  97.     private ?\DateTimeInterface $duplicationStartAt null;
  98.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  99.     private ?\DateTimeInterface $duplicationEndAt null;
  100.     #[ORM\Column(nullabletrue)]
  101.     private ?bool $duplicationMonday null;
  102.     #[ORM\Column(nullabletrue)]
  103.     private array $duplicationDays = [];
  104.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'duplicatedMissions',cascade:["persist"])]
  105.     private ?self $originMission null;
  106.     #[ORM\OneToMany(mappedBy'originMission'targetEntityself::class)]
  107.     private Collection $duplicatedMissions;
  108.     public function __construct()
  109.     {
  110.         $this->missionExtraFees = new ArrayCollection();
  111.         $this->duplicatedMissions = new ArrayCollection();
  112.     }
  113.    
  114.     public function __toString(): string
  115.     {
  116.         return (string)$this->description;
  117.     }
  118.     public function getId(): ?int
  119.     {
  120.         return $this->id;
  121.     }
  122.     public function getMissionNumber():string
  123.     {
  124.         return "BM-0000".$this->id;
  125.     }
  126.     public function getCreatedAt(): ?\DateTimeInterface
  127.     {
  128.         return $this->createdAt;
  129.     }
  130.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  131.     {
  132.         $this->createdAt $createdAt;
  133.         return $this;
  134.     }
  135.     public function getDescription(): ?string
  136.     {
  137.         return $this->description;
  138.     }
  139.     public function setDescription(?string $description): self
  140.     {
  141.         $this->description $description;
  142.         return $this;
  143.     }
  144.     public function getDatePickup(): ?\DateTimeInterface
  145.     {
  146.         return $this->datePickup;
  147.     }
  148.     public function setDatePickup(?\DateTimeInterface $datePickup): self
  149.     {
  150.         $this->datePickup $datePickup;
  151.         return $this;
  152.     }
  153.     public function getTimePickup(): ?\DateTimeInterface
  154.     {
  155.         return $this->timePickup;
  156.     }
  157.     public function setTimePickup(?\DateTimeInterface $timePickup): self
  158.     {
  159.         $this->timePickup $timePickup;
  160.         return $this;
  161.     }
  162.     public function getNbrAdults(): ?int
  163.     {
  164.         return $this->nbrAdults;
  165.     }
  166.     public function setNbrAdults(?int $nbrAdults): self
  167.     {
  168.         $this->nbrAdults $nbrAdults;
  169.         return $this;
  170.     }
  171.     public function getNbrChildrens(): ?int
  172.     {
  173.         return $this->nbrChildrens;
  174.     }
  175.     public function setNbrChildrens(?int $nbrChildrens): self
  176.     {
  177.         $this->nbrChildrens $nbrChildrens;
  178.         return $this;
  179.     }
  180.     public function getNbrBags(): ?int
  181.     {
  182.         return $this->nbrBags;
  183.     }
  184.     public function setNbrBags(?int $nbrBags): self
  185.     {
  186.         $this->nbrBags $nbrBags;
  187.         return $this;
  188.     }
  189.     public function getRelatedOrder(): ?Order
  190.     {
  191.         return $this->relatedOrder;
  192.     }
  193.     public function setRelatedOrder(?Order $relatedOrder): self
  194.     {
  195.         $this->relatedOrder $relatedOrder;
  196.         return $this;
  197.     }
  198.     public function getLang(): ?string
  199.     {
  200.         return $this->lang;
  201.     }
  202.     public function setLang(?string $lang): self
  203.     {
  204.         $this->lang $lang;
  205.         return $this;
  206.     }
  207.     public function getType(): ?string
  208.     {
  209.         return $this->type;
  210.     }
  211.     public function setType(?string $type): self
  212.     {
  213.         $this->type $type;
  214.         return $this;
  215.     }
  216.     public function getHandicap(): ?array
  217.     {
  218.         return $this->handicap;
  219.     }
  220.     public function setHandicap(?array $handicap): self
  221.     {
  222.         $this->handicap $handicap;
  223.         return $this;
  224.     }
  225.     public function getForfait(): array
  226.     {
  227.         return $this->forfait;
  228.     }
  229.     public function setForfait(?array $forfait): self
  230.     {
  231.         $this->forfait $forfait;
  232.         return $this;
  233.     }
  234.     public function getStatus(): ?string
  235.     {
  236.         return $this->status;
  237.     }
  238.     public function setStatus(?string $status): self
  239.     {
  240.         $this->status $status;
  241.         return $this;
  242.     }
  243.     public function getRealPickupDate(): ?\DateTimeInterface
  244.     {
  245.         return $this->realPickupDate;
  246.     }
  247.     public function setRealPickupDate(?\DateTimeInterface $realPickupDate): self
  248.     {
  249.         $this->realPickupDate $realPickupDate;
  250.         return $this;
  251.     }
  252.     public function getRealStartMission(): ?\DateTimeInterface
  253.     {
  254.         return $this->realStartMission;
  255.     }
  256.     public function setRealStartMission(?\DateTimeInterface $realStartMission): self
  257.     {
  258.         $this->realStartMission $realStartMission;
  259.         return $this;
  260.     }
  261.     public function getRealDeliveryDate(): ?\DateTimeInterface
  262.     {
  263.         return $this->realDeliveryDate;
  264.     }
  265.     public function setRealDeliveryDate(?\DateTimeInterface $realDeliveryDate): self
  266.     {
  267.         $this->realDeliveryDate $realDeliveryDate;
  268.         return $this;
  269.     }
  270.     public function getNbrPax(){
  271.         $nbrPax 0;
  272.         $nbrPax $this->getNbrAdults()+$this->getNbrChildrens();
  273.         return  $nbrPax;
  274.     }
  275.     /**
  276.      * Get the value of deletedAt
  277.      */ 
  278.     public function getDeletedAt()
  279.     {
  280.         return $this->deletedAt;
  281.     }
  282.     /**
  283.      * Set the value of deletedAt
  284.      *
  285.      * @return  self
  286.      */ 
  287.     public function setDeletedAt($deletedAt)
  288.     {
  289.         $this->deletedAt $deletedAt;
  290.         return $this;
  291.     }
  292.     public function getShipment(): ?Shipment
  293.     {
  294.         return $this->shipment;
  295.     }
  296.     public function setShipment(?Shipment $shipment): self
  297.     {
  298.         $this->shipment $shipment;
  299.         return $this;
  300.     }
  301.     /**
  302.      * @return Collection<int, MissionExtraFees>
  303.      */
  304.     public function getMissionExtraFees(): Collection
  305.     {
  306.         return $this->missionExtraFees;
  307.     }
  308.     public function addMissionExtraFee(MissionExtraFees $missionExtraFee): self
  309.     {
  310.         if (!$this->missionExtraFees->contains($missionExtraFee)) {
  311.             $this->missionExtraFees->add($missionExtraFee);
  312.             $missionExtraFee->setMission($this);
  313.         }
  314.         return $this;
  315.     }
  316.     public function removeMissionExtraFee(MissionExtraFees $missionExtraFee): self
  317.     {
  318.         if ($this->missionExtraFees->removeElement($missionExtraFee)) {
  319.             // set the owning side to null (unless already changed)
  320.             if ($missionExtraFee->getMission() === $this) {
  321.                 $missionExtraFee->setMission(null);
  322.             }
  323.         }
  324.         return $this;
  325.     }
  326.     public function getTargetMap(){
  327.         return null;
  328.     }
  329.     /**
  330.      * Get the value of endMissionDate
  331.      */ 
  332.     public function getEndMissionDate()
  333.     {
  334.         return $this->endMissionDate;
  335.     }
  336.     /**
  337.      * Set the value of endMissionDate
  338.      *
  339.      * @return  self
  340.      */ 
  341.     public function setEndMissionDate($endMissionDate)
  342.     {
  343.         $this->endMissionDate $endMissionDate;
  344.         return $this;
  345.     }
  346.     /**
  347.      * Get the value of endMissionTime
  348.      */ 
  349.     public function getEndMissionTime()
  350.     {
  351.         return $this->endMissionTime;
  352.     }
  353.     /**
  354.      * Set the value of endMissionTime
  355.      *
  356.      * @return  self
  357.      */ 
  358.     public function setEndMissionTime($endMissionTime)
  359.     {
  360.         $this->endMissionTime $endMissionTime;
  361.         return $this;
  362.     }
  363.     public function isDepartSiege(): ?bool
  364.     {
  365.         return $this->departSiege;
  366.     }
  367.     public function setDepartSiege(?bool $departSiege): self
  368.     {
  369.         $this->departSiege $departSiege;
  370.         return $this;
  371.     }
  372.     public function isSharedShuttle(): ?bool
  373.     {
  374.         return $this->sharedShuttle;
  375.     }
  376.     public function setSharedShuttle(?bool $sharedShuttle): self
  377.     {
  378.         $this->sharedShuttle $sharedShuttle;
  379.         return $this;
  380.     }
  381.     public function getPrice(): ?float
  382.     {
  383.         return $this->price;
  384.     }
  385.     public function setPrice(?float $price): self
  386.     {
  387.         $this->price $price;
  388.         return $this;
  389.     }
  390.     public function getVendorCompanyName(): ?string
  391.     {
  392.         return $this->vendorCompanyName;
  393.     }
  394.     public function setVendorCompanyName(?string $vendorCompanyName): self
  395.     {
  396.         $this->vendorCompanyName $vendorCompanyName;
  397.         return $this;
  398.     }
  399.     public function getLogo(): ?string
  400.     {
  401.         return $this->logo;
  402.     }
  403.     public function setLogo(?string $logo): self
  404.     {
  405.         $this->logo $logo;
  406.         return $this;
  407.     }
  408.     public function getShippingVehicleType(): ?ShippingVehicleType
  409.     {
  410.         return $this->shippingVehicleType;
  411.     }
  412.     public function setShippingVehicleType(?ShippingVehicleType $shippingVehicleType): self
  413.     {
  414.         $this->shippingVehicleType $shippingVehicleType;
  415.         return $this;
  416.     }
  417.     public function getDriverComment(): ?string
  418.     {
  419.         return $this->driverComment;
  420.     }
  421.     public function setDriverComment(?string $driverComment): self
  422.     {
  423.         $this->driverComment $driverComment;
  424.         return $this;
  425.     }
  426.     public function getDriver(): ?Agent
  427.     {
  428.         return $this->driver;
  429.     }
  430.     public function setDriver(?Agent $driver): self
  431.     {
  432.         $this->driver $driver;
  433.         return $this;
  434.     }
  435.     public function isMoneyTakenByDriver(): ?bool
  436.     {
  437.         return $this->moneyTakenByDriver;
  438.     }
  439.     public function setMoneyTakenByDriver(?bool $moneyTakenByDriver): self
  440.     {
  441.         $this->moneyTakenByDriver $moneyTakenByDriver;
  442.         return $this;
  443.     }
  444.     public function getAcceptedByDriver(): ?string
  445.     {
  446.         return $this->acceptedByDriver;
  447.     }
  448.     public function setAcceptedByDriver(?string $acceptedByDriver): self
  449.     {
  450.         $this->acceptedByDriver $acceptedByDriver;
  451.         return $this;
  452.     }
  453.     public function getCustomerGroup(): ?CustomerGroup
  454.     {
  455.         return $this->customerGroup;
  456.     }
  457.     public function setCustomerGroup(?CustomerGroup $customerGroup): self
  458.     {
  459.         $this->customerGroup $customerGroup;
  460.         return $this;
  461.     }
  462.     public function getShippingVehicle(): ?ShippingVehicle
  463.     {
  464.         return $this->shippingVehicle;
  465.     }
  466.     public function setShippingVehicle(?ShippingVehicle $shippingVehicle): self
  467.     {
  468.         $this->shippingVehicle $shippingVehicle;
  469.         return $this;
  470.     }
  471.     public function getDuplicationStartAt(): ?\DateTimeInterface
  472.     {
  473.         return $this->duplicationStartAt;
  474.     }
  475.     public function setDuplicationStartAt(?\DateTimeInterface $duplicationStartAt): self
  476.     {
  477.         $this->duplicationStartAt $duplicationStartAt;
  478.         return $this;
  479.     }
  480.     public function getDuplicationEndAt(): ?\DateTimeInterface
  481.     {
  482.         return $this->duplicationEndAt;
  483.     }
  484.     public function setDuplicationEndAt(?\DateTimeInterface $duplicationEndAt): self
  485.     {
  486.         $this->duplicationEndAt $duplicationEndAt;
  487.         return $this;
  488.     }
  489.     public function isDuplicationMonday(): ?bool
  490.     {
  491.         return $this->duplicationMonday;
  492.     }
  493.     public function setDuplicationMonday(?bool $duplicationMonday): self
  494.     {
  495.         $this->duplicationMonday $duplicationMonday;
  496.         return $this;
  497.     }
  498.     public function getDuplicationDays(): array
  499.     {
  500.         return $this->duplicationDays;
  501.     }
  502.     public function setDuplicationDays(?array $duplicationDays): self
  503.     {
  504.         $this->duplicationDays $duplicationDays;
  505.         return $this;
  506.     }
  507.     public function getOriginMission(): ?self
  508.     {
  509.         return $this->originMission;
  510.     }
  511.     public function setOriginMission(?self $originMission): self
  512.     {
  513.         $this->originMission $originMission;
  514.         return $this;
  515.     }
  516.     /**
  517.      * @return Collection<int, self>
  518.      */
  519.     public function getDuplicatedMissions(): Collection
  520.     {
  521.         return $this->duplicatedMissions;
  522.     }
  523.     public function addDuplicatedMission(self $duplicatedMission): self
  524.     {
  525.         if (!$this->duplicatedMissions->contains($duplicatedMission)) {
  526.             $this->duplicatedMissions->add($duplicatedMission);
  527.             $duplicatedMission->setOriginMission($this);
  528.         }
  529.         return $this;
  530.     }
  531.     public function removeDuplicatedMission(self $duplicatedMission): self
  532.     {
  533.         if ($this->duplicatedMissions->removeElement($duplicatedMission)) {
  534.             // set the owning side to null (unless already changed)
  535.             if ($duplicatedMission->getOriginMission() === $this) {
  536.                 $duplicatedMission->setOriginMission(null);
  537.             }
  538.         }
  539.         return $this;
  540.     }
  541. }