src/Flexy/TransportBundle/Entity/Mission.php line 19

  1. <?php
  2. namespace App\Flexy\TransportBundle\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Order\Order;
  5. use App\Flexy\ShopBundle\Entity\Shipping\Shipment;
  6. use App\Flexy\ShopBundle\Entity\Shipping\ShipmentItem;
  7. use App\Repository\Flexy\TransportBundle\Entity\MissionRepository;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. use Symfony\UX\Turbo\Attribute\Broadcast;
  12. #[ORM\Entity(repositoryClassMissionRepository::class)]
  13. #[ApiResource]
  14. //#[Broadcast]
  15. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  16. class Mission implements \Stringable
  17. {
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     private ?int $id null;
  22.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  23.     private ?\DateTimeInterface $createdAt null;
  24.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  25.     private ?string $description null;
  26.     
  27.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  28.     private ?\DateTimeInterface $datePickup null;
  29.     #[ORM\Column(typeTypes::TIME_MUTABLEnullabletrue)]
  30.     private ?\DateTimeInterface $timePickup null;
  31.     #[ORM\Column(nullabletrue)]
  32.     private ?int $nbrAdults null;
  33.     #[ORM\Column(nullabletrue)]
  34.     private ?int $nbrChildrens null;
  35.     #[ORM\Column(nullabletrue)]
  36.     private ?int $nbrBags null;
  37.     #[ORM\ManyToOne]
  38.     private ?Order $relatedOrder null;
  39.     #[ORM\OneToOne(inversedBy'parentMission'targetEntityself::class, cascade: ['persist''remove'])]
  40.     private ?self $relatedMission null;
  41.     #[ORM\OneToOne(mappedBy'relatedMission'targetEntityself::class, cascade: ['persist''remove'])]
  42.     private ?self $parentMission null;
  43.     #[ORM\Column(length255nullabletrue)]
  44.     private ?string $lang null;
  45.     #[ORM\Column(length255nullabletrue)]
  46.     private ?string $type null;
  47.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  48.     private ?array $handicap null;
  49.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  50.     private array $forfait = [];
  51.     #[ORM\Column(length255nullabletrue)]
  52.     private ?string $status null;
  53.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  54.     private ?\DateTimeInterface $realPickupDate null;
  55.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  56.     private ?\DateTimeInterface $realStartMission null;
  57.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  58.     private ?\DateTimeInterface $realDeliveryDate null;
  59.     #[ORM\Column(nullabletrue)]
  60.     private ?\DateTimeImmutable $deletedAt null;
  61.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  62.     private ?Shipment $shipment null;
  63.    
  64.     public function __toString(): string
  65.     {
  66.         return (string)$this->description;
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getMissionNumber():string
  73.     {
  74.         return "BM-0000".$this->id;
  75.     }
  76.     public function getCreatedAt(): ?\DateTimeInterface
  77.     {
  78.         return $this->createdAt;
  79.     }
  80.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  81.     {
  82.         $this->createdAt $createdAt;
  83.         return $this;
  84.     }
  85.     public function getDescription(): ?string
  86.     {
  87.         return $this->description;
  88.     }
  89.     public function setDescription(?string $description): self
  90.     {
  91.         $this->description $description;
  92.         return $this;
  93.     }
  94.     public function getDatePickup(): ?\DateTimeInterface
  95.     {
  96.         return $this->datePickup;
  97.     }
  98.     public function setDatePickup(?\DateTimeInterface $datePickup): self
  99.     {
  100.         $this->datePickup $datePickup;
  101.         return $this;
  102.     }
  103.     public function getTimePickup(): ?\DateTimeInterface
  104.     {
  105.         return $this->timePickup;
  106.     }
  107.     public function setTimePickup(?\DateTimeInterface $timePickup): self
  108.     {
  109.         $this->timePickup $timePickup;
  110.         return $this;
  111.     }
  112.     public function getNbrAdults(): ?int
  113.     {
  114.         return $this->nbrAdults;
  115.     }
  116.     public function setNbrAdults(?int $nbrAdults): self
  117.     {
  118.         $this->nbrAdults $nbrAdults;
  119.         return $this;
  120.     }
  121.     public function getNbrChildrens(): ?int
  122.     {
  123.         return $this->nbrChildrens;
  124.     }
  125.     public function setNbrChildrens(?int $nbrChildrens): self
  126.     {
  127.         $this->nbrChildrens $nbrChildrens;
  128.         return $this;
  129.     }
  130.     public function getNbrBags(): ?int
  131.     {
  132.         return $this->nbrBags;
  133.     }
  134.     public function setNbrBags(?int $nbrBags): self
  135.     {
  136.         $this->nbrBags $nbrBags;
  137.         return $this;
  138.     }
  139.     public function getRelatedOrder(): ?Order
  140.     {
  141.         return $this->relatedOrder;
  142.     }
  143.     public function setRelatedOrder(?Order $relatedOrder): self
  144.     {
  145.         $this->relatedOrder $relatedOrder;
  146.         return $this;
  147.     }
  148.     public function getRelatedMission(): ?self
  149.     {
  150.         return $this->relatedMission;
  151.     }
  152.     public function setRelatedMission(?self $relatedMission): self
  153.     {
  154.         $this->relatedMission $relatedMission;
  155.         return $this;
  156.     }
  157.     public function getParentMission(): ?self
  158.     {
  159.         return $this->parentMission;
  160.     }
  161.     public function setParentMission(?self $parentMission): self
  162.     {
  163.         // unset the owning side of the relation if necessary
  164.         if ($parentMission === null && $this->parentMission !== null) {
  165.             $this->parentMission->setRelatedMission(null);
  166.         }
  167.         // set the owning side of the relation if necessary
  168.         if ($parentMission !== null && $parentMission->getRelatedMission() !== $this) {
  169.             $parentMission->setRelatedMission($this);
  170.         }
  171.         $this->parentMission $parentMission;
  172.         return $this;
  173.     }
  174.     public function getLang(): ?string
  175.     {
  176.         return $this->lang;
  177.     }
  178.     public function setLang(?string $lang): self
  179.     {
  180.         $this->lang $lang;
  181.         return $this;
  182.     }
  183.     public function getType(): ?string
  184.     {
  185.         return $this->type;
  186.     }
  187.     public function setType(?string $type): self
  188.     {
  189.         $this->type $type;
  190.         return $this;
  191.     }
  192.     public function getHandicap(): ?array
  193.     {
  194.         return $this->handicap;
  195.     }
  196.     public function setHandicap(?array $handicap): self
  197.     {
  198.         $this->handicap $handicap;
  199.         return $this;
  200.     }
  201.     public function getForfait(): array
  202.     {
  203.         return $this->forfait;
  204.     }
  205.     public function setForfait(?array $forfait): self
  206.     {
  207.         $this->forfait $forfait;
  208.         return $this;
  209.     }
  210.     public function getStatus(): ?string
  211.     {
  212.         return $this->status;
  213.     }
  214.     public function setStatus(?string $status): self
  215.     {
  216.         $this->status $status;
  217.         return $this;
  218.     }
  219.     public function getRealPickupDate(): ?\DateTimeInterface
  220.     {
  221.         return $this->realPickupDate;
  222.     }
  223.     public function setRealPickupDate(?\DateTimeInterface $realPickupDate): self
  224.     {
  225.         $this->realPickupDate $realPickupDate;
  226.         return $this;
  227.     }
  228.     public function getRealStartMission(): ?\DateTimeInterface
  229.     {
  230.         return $this->realStartMission;
  231.     }
  232.     public function setRealStartMission(?\DateTimeInterface $realStartMission): self
  233.     {
  234.         $this->realStartMission $realStartMission;
  235.         return $this;
  236.     }
  237.     public function getRealDeliveryDate(): ?\DateTimeInterface
  238.     {
  239.         return $this->realDeliveryDate;
  240.     }
  241.     public function setRealDeliveryDate(?\DateTimeInterface $realDeliveryDate): self
  242.     {
  243.         $this->realDeliveryDate $realDeliveryDate;
  244.         return $this;
  245.     }
  246.     public function getNbrPax(){
  247.         $nbrPax 0;
  248.         $nbrPax $this->getNbrAdults()+$this->getNbrChildrens();
  249.         return  $nbrPax;
  250.     }
  251.     /**
  252.      * Get the value of deletedAt
  253.      */ 
  254.     public function getDeletedAt()
  255.     {
  256.         return $this->deletedAt;
  257.     }
  258.     /**
  259.      * Set the value of deletedAt
  260.      *
  261.      * @return  self
  262.      */ 
  263.     public function setDeletedAt($deletedAt)
  264.     {
  265.         $this->deletedAt $deletedAt;
  266.         return $this;
  267.     }
  268.     public function getShipment(): ?Shipment
  269.     {
  270.         return $this->shipment;
  271.     }
  272.     public function setShipment(?Shipment $shipment): self
  273.     {
  274.         $this->shipment $shipment;
  275.         return $this;
  276.     }
  277. }