src/Flexy/ShopBundle/Entity/Order/Order.php line 50

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Order;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  6. use App\Entity\LogHistory;
  7. use App\Entity\User;
  8. use App\Flexy\ShopBundle\Entity\Accounting\Invoice;
  9. use App\Flexy\ShopBundle\Entity\Customer\Customer;
  10. use App\Flexy\ShopBundle\Entity\Payment\Payment;
  11. use App\Flexy\ShopBundle\Entity\Shipping\Shipment;
  12. use App\Flexy\ShopBundle\Entity\Customer\CustomerWalletPoint;
  13. use App\Flexy\ShopBundle\Entity\Payment\PaymentMethod;
  14. use App\Flexy\ShopBundle\Entity\Promotion\Coupon;
  15. use App\Flexy\ShopBundle\Entity\Shipping\CityRegion;
  16. use App\Flexy\ShopBundle\Entity\Resource\Agent;
  17. use App\Flexy\ShopBundle\Entity\Shipping\ShippingMethod;
  18. use App\Flexy\ShopBundle\Entity\Store\Store;
  19. use App\Flexy\ShopBundle\Entity\Vendor\Vendor;
  20. use App\Flexy\ShopBundle\Repository\Order\OrderRepository;
  21. use Doctrine\Common\Collections\ArrayCollection;
  22. use Doctrine\Common\Collections\Collection;
  23. use Doctrine\DBAL\Types\Types;
  24. use Doctrine\ORM\Mapping as ORM;
  25. use Doctrine\ORM\Mapping\Entity;
  26. use Doctrine\ORM\Mapping\InheritanceType;
  27. use Gedmo\Mapping\Annotation as Gedmo;
  28. use Symfony\Component\Serializer\Annotation\Groups;
  29. use Symfony\Component\Validator\Constraints as Assert;
  30. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  31. #[ApiResource(
  32.     normalizationContext: ['groups' => ['read']],
  33.     denormalizationContext: ['groups' => ['write']],
  34. )]
  35. #[ApiFilter(SearchFilter::class, properties: ['status' => 'exact','customer'=>'exact'])]
  36. #[ORM\Table(name'`order`')]
  37. #[ORM\Entity(repositoryClassOrderRepository::class)]
  38. #[InheritanceType('JOINED')]
  39. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  40. #[Gedmo\Loggable(logEntryClass:LogHistory::class)]
  41. #[UniqueEntity(
  42.     fields: ['reference'],
  43.     errorPath'reference',
  44.     message'This reference is already exist.',
  45. )]
  46. class Order implements \Stringable
  47. {
  48.     #[ORM\Id]
  49.     #[ORM\GeneratedValue]
  50.     #[ORM\Column(type'integer')]
  51.     #[Groups(['read'])]
  52.     private $id;
  53.   
  54.     
  55.     #[Groups(['read'])]
  56.     #[ORM\Column(type'datetime'nullabletrue)]
  57.     private ?\DateTime $createdAt null;
  58.     #[Groups(['read','write'])]
  59.     #[ORM\Column(type'text'nullabletrue)]
  60.     #[Gedmo\Versioned]
  61.     private ?string $description null;
  62.     #[Groups(['read','write'])]
  63.     #[ORM\ManyToOne(targetEntityCustomer::class, inversedBy'orders'cascade: ['persist'])]
  64.     #[Assert\Valid]
  65.     #[Gedmo\Versioned]
  66.     private ?\App\Flexy\ShopBundle\Entity\Customer\Customer $customer null;
  67.     #[Groups(['read','write'])]
  68.     #[ORM\OneToMany(targetEntityOrderItem::class, mappedBy'parentOrder'cascade: ['persist''remove'])]
  69.     #[Assert\Valid]
  70.     
  71.     private \Doctrine\Common\Collections\Collection|array $orderItems;
  72.     
  73.     #[ORM\OneToMany(targetEntityAdjustment::class, mappedBy'parentOrder')]
  74.     private \Doctrine\Common\Collections\Collection|array $adjustments;
  75.     #[ORM\Column(type'string'length255nullabletrue)]
  76.     #[Groups(['read','write'])]
  77.     private ?string $firstName null;
  78.     #[ORM\Column(type'string'length255nullabletrue)]
  79.     #[Groups(['read','write'])]
  80.     private ?string $lastName null;
  81.     #[ORM\Column(type'string'length255nullabletrue)]
  82.     #[Groups(['read','write'])]
  83.     private ?string $companyName null;
  84.     #[ORM\Column(type'string'length255nullabletrue)]
  85.     #[Groups(['read','write'])]
  86.     private ?string $address null;
  87.     #[ORM\Column(type'string'length255nullabletrue)]
  88.     #[Groups(['read','write'])]
  89.     private ?string $city null;
  90.     #[ORM\Column(type'string'length255nullabletrue)]
  91.     #[Groups(['read','write'])]
  92.     private ?string $country null;
  93.     #[ORM\Column(type'string'length255nullabletrue)]
  94.     private ?string $department null;
  95.     #[ORM\Column(type'string'length255nullabletrue)]
  96.     private ?string $postcode null;
  97.     #[ORM\Column(type'string'length255nullabletrue)]
  98.     #[Groups(['read','write'])]
  99.     private ?string $email null;
  100.     #[ORM\Column(type'string'length255nullabletrue)]
  101.     #[Groups(['read','write'])]
  102.     private ?string $tel null;
  103.     #[ORM\Column(type'text'nullabletrue)]
  104.     private ?string $comment null;
  105.     #[ORM\ManyToOne(targetEntityDemandeFund::class, inversedBy'orders')]
  106.     private ?\App\Flexy\ShopBundle\Entity\Order\DemandeFund $demandeFund null;
  107.     #[Groups(['read','write'])]
  108.     #[ORM\Column(type'string'length255nullabletrue)]
  109.     #[Gedmo\Versioned]
  110.     private ?string $status "draft";
  111.     
  112.     #[ORM\Column(type'string'length255nullabletrue)]
  113.     private ?string $source null;
  114.     #[ORM\Column(type'text'nullabletrue)]
  115.     private $deliveryAt;
  116.     #[ORM\Column(type'text'nullabletrue)]
  117.     private $recoveryAt;
  118.     #[ORM\Column(type'string'length255nullabletrue)]
  119.     private ?string $oldOrderNumber null;
  120.     #[ORM\Column(type'float'nullabletrue)]
  121.     private ?float $reduction null;
  122.     #[ORM\Column(type'float'nullabletrue)]
  123.     private $distance 0;
  124.     #[ORM\ManyToOne(targetEntityShippingMethod::class, inversedBy'orders'cascade: ['persist'])]
  125.     #[Groups(['read','write'])]
  126.     #[Gedmo\Versioned]
  127.     private ?\App\Flexy\ShopBundle\Entity\Shipping\ShippingMethod $shippingMethod null;
  128.     #[ORM\ManyToOne(targetEntityAgent::class, inversedBy'orders')]
  129.     #[Groups(['read','write'])]
  130.     #[Gedmo\Versioned]
  131.     private ?\App\Flexy\ShopBundle\Entity\Resource\Agent $agent null;
  132.     #[Groups(['read','write'])]
  133.     #[ORM\ManyToOne(targetEntitypaymentMethod::class, inversedBy'orders'cascade: ['persist'])]
  134.     #[ORM\JoinColumn(nullabletrueonDelete'CASCADE')]
  135.     
  136.     private ?\App\Flexy\ShopBundle\Entity\Payment\PaymentMethod $paymentMethod null;
  137.     #[ORM\Column(type'float'nullabletrue)]
  138.     #[Groups(['read','write'])]
  139.     #[Gedmo\Versioned]
  140.     private ?float $payedAmount null;
  141.     #[ORM\Column(type'datetime'nullabletrue)]
  142.     #[Groups(['read','write'])]
  143.     #[Gedmo\Versioned]
  144.     private ?\DateTimeInterface $startProcessingAt null;
  145.     #[ORM\Column(type'string'length255nullabletrue)]
  146.     private ?string $deliveryType null;
  147.     #[ORM\Column(type'datetime'nullabletrue)]
  148.     #[Groups(['read','write'])]
  149.     #[Gedmo\Versioned]
  150.     private ?\DateTimeInterface $startDeliveryAt null;
  151.     #[ORM\OneToMany(targetEntityCustomerWalletPoint::class, mappedBy'originOrder')]
  152.     private \Doctrine\Common\Collections\Collection|array $customerWalletPoints;
  153.     #[ORM\ManyToOne(targetEntityCoupon::class, inversedBy'orders')]
  154.     #[Groups(['read','write'])]
  155.     private ?\App\Flexy\ShopBundle\Entity\Promotion\Coupon $coupon null;
  156.     #[ORM\ManyToOne(targetEntityAgent::class, inversedBy'ordersToDolist')]
  157.     private ?\App\Flexy\ShopBundle\Entity\Resource\Agent $agentToDo null;
  158.     #[ORM\Column(type'boolean'nullabletrue)]
  159.     private ?bool $isToDo null;
  160.     #[ORM\ManyToOne(targetEntityCityRegion::class, inversedBy'orders')]
  161.     private ?\App\Flexy\ShopBundle\Entity\Shipping\CityRegion $cityRegionShipping null;
  162.     #[ORM\ManyToOne(targetEntityCityRegion::class, inversedBy'collectedOrders')]
  163.     private $cityRegionCollect;
  164.     #[ORM\ManyToOne(targetEntityVendor::class, inversedBy'orders')]
  165.     private ?\App\Flexy\ShopBundle\Entity\Vendor\Vendor $vendor null;
  166.     #[ORM\Column(type'text'nullabletrue)]
  167.     #[Groups(['read','write'])]
  168.     private ?string $collectAddress null;
  169.     #[ORM\Column(type'text'nullabletrue)]
  170.     #[Groups(['read','write'])]
  171.     private ?string $shippingAddress null;
  172.     #[ORM\Column(type'string'length255nullabletrue)]
  173.     #[Groups(['read','write'])]
  174.     private ?string $collectTel null;
  175.     #[ORM\Column(type'boolean'nullabletrue)]
  176.     #[Groups(['read','write'])]
  177.     private ?bool $isHeavy null;
  178.     #[ORM\Column(type'float'nullabletrue)]
  179.     private $shippingTips 0;
  180.      #[ORM\Column(type'float'nullabletrue)]
  181.     private $walletPaymentAmount 0;
  182.     #[ORM\Column(type'boolean'nullabletrue)]
  183.     private $isChecked;
  184.     #[ORM\Column(type'string'length255nullabletrue)]
  185.     private $tokenStripe;
  186.     #[ORM\Column(length255nullabletrue)]
  187.     private ?string $orderType "order";
  188.     #[ORM\Column(nullabletrue)]
  189.     private ?\DateTimeImmutable $deletedAt null;
  190.     #[ORM\ManyToOne(inversedBy'orders')]
  191.     private ?Store $store null;
  192.     #[ORM\OneToOne(inversedBy'relatedOrder'cascade: ['persist''remove'])]
  193.     private ?Shipment $shipment null;
  194.     #[ORM\ManyToOne(inversedBy'orders')]
  195.     private ?Invoice $invoice null;
  196.     #[ORM\Column(typeTypes::STRING,nullabletrue)]
  197.     #[Gedmo\Blameable(on'create')]
  198.     private $createdBy;
  199.     #[ORM\OneToMany(mappedBy'relatedOrder'targetEntityPayment::class,cascade:["persist"])]
  200.     private Collection $payments;
  201.     #[ORM\Column(length255nullabletrue,unique:true)]
  202.     private ?string $reference null;
  203.     #[ORM\ManyToOne(inversedBy'orders',cascade:["persist"])]
  204.     #[ORM\JoinColumn(name"cash_box_order_id"referencedColumnName"id"onDelete"SET NULL")]
  205.     private ?CashBoxOrder $cashBoxOrder null;
  206.     #[ORM\Column(nullabletrue)]
  207.     private ?bool $is_multiclub null;
  208.     #[ORM\Column(nullabletrue)]
  209.      private ?bool $is_local null;
  210.     
  211.     private ?string $accessChoice null;
  212.     public function __construct()
  213.     {
  214.         $this->orderItems = new ArrayCollection();
  215.         $this->adjustments = new ArrayCollection();
  216.         $this->createdAt = new \DateTime();
  217.         $this->customerWalletPoints = new ArrayCollection();
  218.         $this->payments = new ArrayCollection();
  219.         
  220.     }
  221.    
  222.     public function __toString(): string
  223.     {
  224.         return $this->getOrderNumber();
  225.     }
  226.     public function getId(): ?int
  227.     {
  228.         return $this->id;
  229.     }
  230.     #[Groups(['read'])]
  231.     public function getOrderNumber($secondaryPrefix=null)
  232.     {
  233.         $prefix "";
  234.         
  235.         $orderNumber $prefix.$this->createdAt->format("ym").str_pad((string) $this->id5"0"STR_PAD_LEFT);
  236.         if($secondaryPrefix){
  237.             $orderNumber $prefix.$this->createdAt->format("ym").str_pad((string) $this->id5"0"STR_PAD_LEFT)."-".$secondaryPrefix;
  238.         }
  239.         if($this->reference){
  240.             return $this->reference;
  241.         }
  242.         return $orderNumber;
  243.     }
  244.     #[Groups(['read'])]
  245.     public function getIdPrefixed()
  246.     {
  247.         return $this->getOrderNumber();
  248.     }
  249.     public function getCreatedAt(): ?\DateTime
  250.     {
  251.         return $this->createdAt;
  252.     }
  253.     public function setCreatedAt(?\DateTime $createdAt): self
  254.     {
  255.         $this->createdAt $createdAt;
  256.         return $this;
  257.     }
  258.     public function getCashBoxOrderStartAt(): ?\DateTime
  259.     {
  260.             return $this->cashBoxOrder $this->cashBoxOrder->getStartAt() : null;
  261.     }
  262.      public function getCashBoxOrderEndAt(): ?\DateTime
  263.     {
  264.             return $this->cashBoxOrder $this->cashBoxOrder->getEndAt() : null;
  265.     }
  266.     public function getCustomer(): ?Customer
  267.     {
  268.         return $this->customer;
  269.     }
  270.     public function setCustomer(?Customer $customer): self
  271.     {
  272.         $this->customer $customer;
  273.         return $this;
  274.     }
  275.     public function getCategoriesProduct(){
  276.         $categories = [];
  277.         foreach($this->getOrderItems() as $singleOrderItem){
  278.             if($singleOrderItem->getProduct()){
  279.                 if($singleOrderItem->getProduct()->getParentCategory()){
  280.                     $categories[] = $singleOrderItem->getProduct()->getParentCategory()->getName();
  281.                 }
  282.                 
  283.             }
  284.         }
  285.         return $categories;
  286.     }
  287.     public function getSubCategoriesProduct(){
  288.         $categories = [];
  289.         foreach($this->getOrderItems() as $singleOrderItem){
  290.             if($singleOrderItem->getProduct()){
  291.                 foreach($singleOrderItem->getProduct()->getCategoriesProduct() as $singleCategory){
  292.                     if(!in_array($singleCategory->getName(),$categories)){
  293.                         $categories[] = $singleCategory->getName();
  294.                     }
  295.                     
  296.                 }
  297.                 
  298.             }
  299.         }
  300.         return $categories;
  301.     }
  302.     /**
  303.      * @return Collection|OrderItem[]
  304.      */
  305.     public function getOrderItems(): Collection
  306.     {
  307.         return $this->orderItems;
  308.     }
  309.     public function addOrderItem(OrderItem $orderItem): self
  310.     {
  311.         if (!$this->orderItems->contains($orderItem)) {
  312.             $this->orderItems[] = $orderItem;
  313.             $orderItem->setParentOrder($this);
  314.         }
  315.         return $this;
  316.     }
  317.     public function removeOrderItem(OrderItem $orderItem): self
  318.     {
  319.         if ($this->orderItems->removeElement($orderItem)) {
  320.             // set the owning side to null (unless already changed)
  321.             if ($orderItem->getParentOrder() === $this) {
  322.                 $orderItem->setParentOrder(null);
  323.             }
  324.         }
  325.         return $this;
  326.     }
  327.     /**
  328.      * @return Collection|Adjustment[]
  329.      */
  330.     public function getAdjustments(): Collection
  331.     {
  332.         return $this->adjustments;
  333.     }
  334.     public function addAdjustment(Adjustment $adjustment): self
  335.     {
  336.         if (!$this->adjustments->contains($adjustment)) {
  337.             $this->adjustments[] = $adjustment;
  338.             $adjustment->setParentOrder($this);
  339.         }
  340.         return $this;
  341.     }
  342.     public function removeAdjustment(Adjustment $adjustment): self
  343.     {
  344.         if ($this->adjustments->removeElement($adjustment)) {
  345.             // set the owning side to null (unless already changed)
  346.             if ($adjustment->getParentOrder() === $this) {
  347.                 $adjustment->setParentOrder(null);
  348.             }
  349.         }
  350.         return $this;
  351.     }
  352.     public function getReductionOnCoupon(){
  353.         $reductionCoupon=0;
  354.         if($this->getCoupon()){
  355.             if($this->getCoupon()->getTypeReduction()=="percent"){
  356.                 $reductionCoupon = ($this->getTotalAmount()/100)*$this->getCoupon()->getValueReduction();
  357.             }else{
  358.                 $reductionCoupon $this->getCoupon()->getValueReduction();
  359.             }
  360.         }
  361.         return  $reductionCoupon;
  362.     }
  363.     public function getFirstName(): ?string
  364.     {
  365.         return $this->firstName;
  366.     }
  367.     public function setFirstName(string $firstName): self
  368.     {
  369.         $this->firstName $firstName;
  370.         return $this;
  371.     }
  372.     public function getLastName(): ?string
  373.     {
  374.         return $this->lastName;
  375.     }
  376.     public function setLastName(string $lastName): self
  377.     {
  378.         $this->lastName $lastName;
  379.         return $this;
  380.     }
  381.     public function getCompanyName(): ?string
  382.     {
  383.         return $this->companyName;
  384.     }
  385.     public function setCompanyName(?string $companyName): self
  386.     {
  387.         $this->companyName $companyName;
  388.         return $this;
  389.     }
  390.     public function getAddress(): ?string
  391.     {
  392.         return $this->address;
  393.     }
  394.     public function setAddress(string $address): self
  395.     {
  396.         $this->address $address;
  397.         return $this;
  398.     }
  399.     public function getCity(): ?string
  400.     {
  401.         return $this->city;
  402.     }
  403.     public function setCity(string $city): self
  404.     {
  405.         $this->city $city;
  406.         return $this;
  407.     }
  408.     public function getCountry(): ?string
  409.     {
  410.         return $this->country;
  411.     }
  412.     public function setCountry(string $country): self
  413.     {
  414.         $this->country $country;
  415.         return $this;
  416.     }
  417.     public function getDepartment(): ?string
  418.     {
  419.         return $this->department;
  420.     }
  421.     public function setDepartment(?string $department): self
  422.     {
  423.         $this->department $department;
  424.         return $this;
  425.     }
  426.     public function getPostcode(): ?string
  427.     {
  428.         return $this->postcode;
  429.     }
  430.     public function setPostcode(?string $postcode): self
  431.     {
  432.         $this->postcode $postcode;
  433.         return $this;
  434.     }
  435.     public function getEmail(): ?string
  436.     {
  437.         return $this->email;
  438.     }
  439.     public function setEmail(string $email): self
  440.     {
  441.         $this->email $email;
  442.         return $this;
  443.     }
  444.     public function getTel(): ?string
  445.     {
  446.         return $this->tel;
  447.     }
  448.     public function setTel(string $tel): self
  449.     {
  450.         $this->tel $tel;
  451.         return $this;
  452.     }
  453.     public function getComment(): ?string
  454.     {
  455.         return $this->comment;
  456.     }
  457.     public function setComment(?string $comment): self
  458.     {
  459.         $this->comment $comment;
  460.         return $this;
  461.     }
  462.   
  463.     #[Groups(['read'])]
  464.     public function getTotalAmount(){
  465.         $total=0;
  466.         foreach($this->orderItems as $singleOrderItem){
  467.             $total $total + ($singleOrderItem->getTotalAmount());
  468.         }
  469.         return $total;
  470.         
  471.     }
  472.     //needs optimisation
  473.     #[Groups(['read'])]
  474.     public function getShippingFees(){
  475.         $fees 0;
  476.         if($this->getShippingMethod()){
  477.             if($this->getShippingMethod()->isIsSeparatelyCalculated()){
  478.                 $fees $this->getShippingMethod()->getPrice();
  479.             
  480.                 foreach($this->getShippingMethod()->getShippingRules() as $shippingRule){
  481.     
  482.     
  483.                     if($shippingRule->getTypeCalculation() == "distance"){
  484.                         if( $shippingRule->getMin() < $this->getDistance()  and   $shippingRule->getMax() >= $this->getDistance() ){
  485.                             $fees =  $this->getDistance() * $shippingRule->getValueCalculation();
  486.     
  487.                             /*Condition for TLCS may be it works for all people*/
  488.                             if ($fees $this->getShippingMethod()->getPrice()){
  489.                                 $fees $this->getShippingMethod()->getPrice();
  490.                             }
  491.                             /*Condition for TLCS may be it works for all people*/
  492.                         }
  493.                         
  494.                     }
  495.                         else{
  496.                             if(
  497.                             $shippingRule->getMin() < $this->getTotalAmount() and $shippingRule->getMax() >=  $this->getTotalAmount()
  498.                             
  499.                             ){
  500.                                 if($shippingRule->getTypeCalculation() == "percent"){
  501.                                     $fees = ($this->getTotalAmount() / 100 ) * $shippingRule->getValueCalculation();
  502.                                 }
  503.                                 else{
  504.                                     $fees =  $shippingRule->getValueCalculation();
  505.                                 }
  506.                             }
  507.                         
  508.                     }
  509.     
  510.                     
  511.                 }
  512.             }
  513.             
  514.         }
  515.     
  516.         
  517.         
  518.         return $fees;
  519.     }
  520.     #[Groups(['read'])]
  521.     public function getTotalReduction(){
  522.         $total=0;
  523.         
  524.         foreach($this->orderItems as $singleOrderItem){
  525.             $total $total + ($singleOrderItem->getReduction());
  526.         }
  527.         return $total;
  528.     }
  529.     public function getReductionOnTotal(){
  530.         $reductionAmount 0;
  531.         
  532.         if($this->getReduction() and $this->getReduction()>0){
  533.             $reductionAmount = ($this->getTotalAmount() / 100) * $this->getReduction();
  534.         }
  535.         return $reductionAmount;
  536.     }
  537.     #[Groups(['read'])]
  538.     public function getAmountPayedByCredit(){
  539.         $total=0;
  540.         foreach($this->getCustomerWalletPoints() as $singleWalletPoints){
  541.             if($singleWalletPoints->getPoints()<0){
  542.                 $total $total + ($singleWalletPoints->getPoints());
  543.             }
  544.             
  545.         }
  546.         return $total;
  547.     }
  548.     #[Groups(['read'])]
  549.     public function getAmountEarnedAsCredit(){
  550.         $total=0;
  551.         foreach($this->getCustomerWalletPoints() as $singleWalletPoints){
  552.             if($singleWalletPoints->getPoints()>0){
  553.                 $total $total + ($singleWalletPoints->getPoints());
  554.             }
  555.             
  556.         }
  557.         return $total;
  558.     }
  559.     public function getDemandeFund(): ?DemandeFund
  560.     {
  561.         return $this->demandeFund;
  562.     }
  563.     public function setDemandeFund(?DemandeFund $demandeFund): self
  564.     {
  565.         $this->demandeFund $demandeFund;
  566.         return $this;
  567.     }
  568.     public function getStatus(): ?string
  569.     {
  570.         $status "order_finance_verification_pending";
  571.         if($this->status)
  572.         {
  573.             $status $this->status;
  574.         }
  575.         return $status;
  576.     }
  577.     public function setStatus(?string $status): self
  578.     {
  579.         $this->status $status;
  580.         return $this;
  581.     }
  582.     // BySamir : TO CLEAN
  583.  
  584.     public function getSource(): ?string
  585.     {
  586.         return $this->source;
  587.     }
  588.     public function setSource(?string $source): self
  589.     {
  590.         $this->source $source;
  591.         return $this;
  592.     }
  593.     public function getDeliveryAt()
  594.     {
  595.         return $this->deliveryAt;
  596.     }
  597.     public function setDeliveryAt($deliveryAt)
  598.     {
  599.         $this->deliveryAt $deliveryAt;
  600.         return $this;
  601.     }
  602.     public function getRecoveryAt()
  603.     {
  604.         return $this->recoveryAt;
  605.     }
  606.     public function setRecoveryAt($recoveryAt)
  607.     {
  608.         $this->recoveryAt $recoveryAt;
  609.         return $this;
  610.     }
  611.     public function getReduction(): ?float
  612.     {
  613.         return $this->reduction;
  614.     }
  615.     public function setReduction(?float $reduction): self
  616.     {
  617.         $this->reduction $reduction;
  618.         return $this;
  619.     }
  620.     public function getShippingMethod(): ?ShippingMethod
  621.     {
  622.         return $this->shippingMethod;
  623.     }
  624.     public function setShippingMethod(?ShippingMethod $shippingMethod): self
  625.     {
  626.         $this->shippingMethod $shippingMethod;
  627.         return $this;
  628.     }
  629.     public function getAgent(): ?Agent
  630.     {
  631.         return $this->agent;
  632.     }
  633.     public function setAgent(?Agent $agent): self
  634.     {
  635.         $this->agent $agent;
  636.         return $this;
  637.     }
  638.     public function getPaymentMethod(): ?paymentMethod
  639.     {
  640.         return $this->paymentMethod;
  641.     }
  642.     public function setPaymentMethod(?paymentMethod $paymentMethod): self
  643.     {
  644.         $this->paymentMethod $paymentMethod;
  645.         return $this;
  646.     }
  647.     public function getPayedAmount(): ?float
  648.     {
  649.         return $this->payedAmount;
  650.     }
  651.     public function setPayedAmount(?float $payedAmount): self
  652.     {
  653.         $this->payedAmount $payedAmount;
  654.         return $this;
  655.     }
  656.     public function getStartProcessingAt(): ?\DateTimeInterface
  657.     {
  658.         return $this->startProcessingAt;
  659.     }
  660.     public function setStartProcessingAt(?\DateTimeInterface $startProcessingAt): self
  661.     {
  662.         $this->startProcessingAt $startProcessingAt;
  663.         return $this;
  664.     }
  665.     public function getDeliveryType(): ?string
  666.     {
  667.         return $this->deliveryType;
  668.     }
  669.     public function setDeliveryType(?string $deliveryType): self
  670.     {
  671.         $this->deliveryType $deliveryType;
  672.         return $this;
  673.     }
  674.     public function getStartDeliveryAt(): ?\DateTimeInterface
  675.     {
  676.         return $this->startDeliveryAt;
  677.     }
  678.     public function setStartDeliveryAt(?\DateTimeInterface $startDeliveryAt): self
  679.     {
  680.         $this->startDeliveryAt $startDeliveryAt;
  681.         return $this;
  682.     }
  683.     /**
  684.      * @return Collection<int, CustomerWalletPoint>
  685.      */
  686.     public function getCustomerWalletPoints(): Collection
  687.     {
  688.         return $this->customerWalletPoints;
  689.     }
  690.     public function addCustomerWalletPoint(CustomerWalletPoint $customerWalletPoint): self
  691.     {
  692.         if (!$this->customerWalletPoints->contains($customerWalletPoint)) {
  693.             $this->customerWalletPoints[] = $customerWalletPoint;
  694.             $customerWalletPoint->setOriginOrder($this);
  695.         }
  696.         return $this;
  697.     }
  698.     public function removeCustomerWalletPoint(CustomerWalletPoint $customerWalletPoint): self
  699.     {
  700.         if ($this->customerWalletPoints->removeElement($customerWalletPoint)) {
  701.             // set the owning side to null (unless already changed)
  702.             if ($customerWalletPoint->getOriginOrder() === $this) {
  703.                 $customerWalletPoint->setOriginOrder(null);
  704.             }
  705.         }
  706.         return $this;
  707.     }
  708.     public function getCoupon(): ?Coupon
  709.     {
  710.         return $this->coupon;
  711.     }
  712.     public function setCoupon(?Coupon $coupon): self
  713.     {
  714.         $this->coupon $coupon;
  715.         return $this;
  716.     }
  717.     public function getAgentToDo(): ?Agent
  718.     {
  719.         return $this->agentToDo;
  720.     }
  721.     public function setAgentToDo(?Agent $agentToDo): self
  722.     {
  723.         $this->agentToDo $agentToDo;
  724.         return $this;
  725.     }
  726.     public function getIsToDo(): ?bool
  727.     {
  728.         return $this->isToDo;
  729.     }
  730.     public function setIsToDo(?bool $isToDo): self
  731.     {
  732.         $this->isToDo $isToDo;
  733.         return $this;
  734.     }
  735.     public function getCityRegionShipping(): ?CityRegion
  736.     {
  737.         return $this->cityRegionShipping;
  738.     }
  739.     public function setCityRegionShipping(?CityRegion $cityRegionShipping): self
  740.     {
  741.         $this->cityRegionShipping $cityRegionShipping;
  742.         return $this;
  743.     }
  744.     public function getVendor(): ?Vendor
  745.     {
  746.         return $this->vendor;
  747.     }
  748.     public function setVendor(?Vendor $vendor): self
  749.     {
  750.         $this->vendor $vendor;
  751.         return $this;
  752.     }
  753.     public function getCollectAddress(): ?string
  754.     {
  755.         return $this->collectAddress;
  756.     }
  757.     public function setCollectAddress(?string $collectAddress): self
  758.     {
  759.         $this->collectAddress $collectAddress;
  760.         return $this;
  761.     }
  762.     public function getCollectTel(): ?string
  763.     {
  764.         return $this->collectTel;
  765.     }
  766.     public function setCollectTel(?string $collectTel): self
  767.     {
  768.         $this->collectTel $collectTel;
  769.         return $this;
  770.     }
  771.     public function getIsHeavy(): ?bool
  772.     {
  773.         return $this->isHeavy;
  774.     }
  775.     public function setIsHeavy(?bool $isHeavy): self
  776.     {
  777.         $this->isHeavy $isHeavy;
  778.         return $this;
  779.     }
  780.     public function getShippingTips(): ?float
  781.     {
  782.         return $this->shippingTips;
  783.     }
  784.     public function setShippingTips(?float $shippingTips): self
  785.     {
  786.         $this->shippingTips $shippingTips;
  787.         return $this;
  788.     }
  789.  
  790.     
  791.     /**
  792.      * Get the value of isChecked
  793.      */ 
  794.     public function getIsChecked()
  795.     {
  796.         return $this->isChecked;
  797.     }
  798.     /**
  799.      * Set the value of isChecked
  800.      *
  801.      * @return  self
  802.      */ 
  803.     public function setIsChecked($isChecked)
  804.     {
  805.         $this->isChecked $isChecked;
  806.         return $this;
  807.     }
  808.     /**
  809.      * Get the value of walletPaymentAmount
  810.      */ 
  811.     public function getWalletPaymentAmount()
  812.     {
  813.         return $this->walletPaymentAmount;
  814.     }
  815.     /**
  816.      * Set the value of walletPaymentAmount
  817.      *
  818.      * @return  self
  819.      */ 
  820.     public function setWalletPaymentAmount($walletPaymentAmount)
  821.     {
  822.         $this->walletPaymentAmount $walletPaymentAmount;
  823.         return $this;
  824.     }
  825.     /**
  826.      * Get the value of cityRegionCollect
  827.      */ 
  828.     public function getCityRegionCollect()
  829.     {
  830.         return $this->cityRegionCollect;
  831.     }
  832.     /**
  833.      * Set the value of cityRegionCollect
  834.      *
  835.      * @return  self
  836.      */ 
  837.     public function setCityRegionCollect($cityRegionCollect)
  838.     {
  839.         $this->cityRegionCollect $cityRegionCollect;
  840.         return $this;
  841.     }
  842.     /**
  843.      * Get the value of distance
  844.      */ 
  845.     public function getDistance()
  846.     {
  847.         return $this->distance;
  848.     }
  849.     /**
  850.      * Set the value of distance
  851.      *
  852.      * @return  self
  853.      */ 
  854.     public function setDistance($distance)
  855.     {
  856.         $this->distance $distance;
  857.         return $this;
  858.     }
  859.     /**
  860.      * Get the value of tokenStripe
  861.      */ 
  862.     public function getTokenStripe()
  863.     {
  864.         return $this->tokenStripe;
  865.     }
  866.     /**
  867.      * Set the value of tokenStripe
  868.      *
  869.      * @return  self
  870.      */ 
  871.     public function setTokenStripe($tokenStripe)
  872.     {
  873.         $this->tokenStripe $tokenStripe;
  874.         return $this;
  875.     }
  876.     public function getOrderType(): ?string
  877.     {
  878.         return $this->orderType;
  879.     }
  880.     public function setOrderType(?string $orderType): self
  881.     {
  882.         $this->orderType $orderType;
  883.         return $this;
  884.     }
  885.     /**
  886.      * Get the value of deletedAt
  887.      */ 
  888.     public function getDeletedAt()
  889.     {
  890.         return $this->deletedAt;
  891.     }
  892.     /**
  893.      * Set the value of deletedAt
  894.      *
  895.      * @return  self
  896.      */ 
  897.     public function setDeletedAt($deletedAt)
  898.     {
  899.         $this->deletedAt $deletedAt;
  900.         return $this;
  901.     }
  902.     public function getStore(): ?Store
  903.     {
  904.         return $this->store;
  905.     }
  906.     public function setStore(?Store $store): self
  907.     {
  908.         $this->store $store;
  909.         return $this;
  910.     }
  911.     public function getShipment(): ?Shipment
  912.     {
  913.         return $this->shipment;
  914.     }
  915.     public function setShipment(?Shipment $shipment): self
  916.     {
  917.         $this->shipment $shipment;
  918.         return $this;
  919.     }
  920.     public function getInvoice(): ?Invoice
  921.     {
  922.         return $this->invoice;
  923.     }
  924.     public function setInvoice(?Invoice $invoice): self
  925.     {
  926.         $this->invoice $invoice;
  927.         return $this;
  928.     }
  929.     /**
  930.      * Get the value of shippingAddress
  931.      */ 
  932.     public function getShippingAddress()
  933.     {
  934.         return $this->shippingAddress;
  935.     }
  936.     /**
  937.      * Set the value of shippingAddress
  938.      *
  939.      * @return  self
  940.      */ 
  941.     public function setShippingAddress($shippingAddress)
  942.     {
  943.         $this->shippingAddress $shippingAddress;
  944.         return $this;
  945.     }
  946.     public function getCreatedBy()
  947.     {
  948.         return $this->createdBy;
  949.     }
  950.     public function getDescription(): ?string
  951.     {
  952.         return $this->description;
  953.     }
  954.     public function setDescription(?string $description): self
  955.     {
  956.         $this->description $description;
  957.         return $this;
  958.     }
  959.     /**
  960.      * @return Collection<int, Payment>
  961.      */
  962.     public function getPayments(): Collection
  963.     {
  964.         return $this->payments;
  965.     }
  966.     public function addPayment(Payment $payment): self
  967.     {
  968.         if (!$this->payments->contains($payment)) {
  969.             $this->payments->add($payment);
  970.             $payment->setRelatedOrder($this);
  971.         }
  972.         return $this;
  973.     }
  974.     public function removePayment(Payment $payment): self
  975.     {
  976.         if ($this->payments->removeElement($payment)) {
  977.             // set the owning side to null (unless already changed)
  978.             if ($payment->getRelatedOrder() === $this) {
  979.                 $payment->setRelatedOrder(null);
  980.             }
  981.         }
  982.         return $this;
  983.     }
  984.     public function getReference(): ?string
  985.     {
  986.         return $this->reference;
  987.     }
  988.     public function setReference(?string $reference): self
  989.     {
  990.         $this->reference $reference;
  991.         return $this;
  992.     }
  993.     public function getCashBoxOrder(): ?CashBoxOrder
  994.     {
  995.         return $this->cashBoxOrder;
  996.     }
  997.     public function setCashBoxOrder(?CashBoxOrder $cashBoxOrder): self
  998.     {
  999.         $this->cashBoxOrder $cashBoxOrder;
  1000.         return $this;
  1001.     }
  1002.     public function isIsMulticlub(): ?bool
  1003.     {
  1004.         return $this->is_multiclub;
  1005.     }
  1006.     public function setIsMulticlub(?bool $is_multiclub): static
  1007.     {
  1008.         $this->is_multiclub $is_multiclub;
  1009.        if ($is_multiclub) {
  1010.         $this->is_local false;
  1011.     }
  1012.     return $this;
  1013.     }
  1014.     public function isIsLocal(): ?bool
  1015.     {
  1016.         return $this->is_local;
  1017.     }
  1018.     public function setIsLocal(?bool $is_local): static
  1019.     {
  1020.         $this->is_local $is_local;
  1021.         if ($is_local) {
  1022.         $this->is_multiclub false;
  1023.       }
  1024.     return $this;
  1025.     }
  1026.         public function getAccessChoice(): string
  1027.         {
  1028.             if ($this->is_multiclub) {
  1029.                 return 'multiclub';
  1030.             }
  1031.         
  1032.             return 'local';
  1033.         }
  1034.         
  1035.         public function setAccessChoice(?string $accessChoice): self
  1036.         {
  1037.             $this->accessChoice $accessChoice;
  1038.         
  1039.             if ($accessChoice === 'multiclub') {
  1040.                 $this->is_multiclub true;
  1041.                 $this->is_local false;
  1042.             } else {
  1043.                 $this->is_local true;
  1044.                 $this->is_multiclub false;
  1045.             }
  1046.         
  1047.             return $this;
  1048.         }
  1049. }