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.  
  213.     public function __construct()
  214.     {
  215.         $this->orderItems = new ArrayCollection();
  216.         $this->adjustments = new ArrayCollection();
  217.         $this->createdAt = new \DateTime();
  218.         $this->customerWalletPoints = new ArrayCollection();
  219.         $this->payments = new ArrayCollection();
  220.         
  221.     }
  222.    
  223.     public function __toString(): string
  224.     {
  225.         return $this->getOrderNumber();
  226.     }
  227.     public function getId(): ?int
  228.     {
  229.         return $this->id;
  230.     }
  231.     #[Groups(['read'])]
  232.     public function getOrderNumber($secondaryPrefix=null)
  233.     {
  234.         $prefix "";
  235.         
  236.         $orderNumber $prefix.$this->createdAt->format("ym").str_pad((string) $this->id5"0"STR_PAD_LEFT);
  237.         if($secondaryPrefix){
  238.             $orderNumber $prefix.$this->createdAt->format("ym").str_pad((string) $this->id5"0"STR_PAD_LEFT)."-".$secondaryPrefix;
  239.         }
  240.         if($this->reference){
  241.             return $this->reference;
  242.         }
  243.         return $orderNumber;
  244.     }
  245.     #[Groups(['read'])]
  246.     public function getIdPrefixed()
  247.     {
  248.         return $this->getOrderNumber();
  249.     }
  250.     public function getCreatedAt(): ?\DateTime
  251.     {
  252.         return $this->createdAt;
  253.     }
  254.     public function setCreatedAt(?\DateTime $createdAt): self
  255.     {
  256.         $this->createdAt $createdAt;
  257.         return $this;
  258.     }
  259.     public function getCashBoxOrderStartAt(): ?\DateTime
  260.     {
  261.             return $this->cashBoxOrder $this->cashBoxOrder->getStartAt() : null;
  262.     }
  263.      public function getCashBoxOrderEndAt(): ?\DateTime
  264.     {
  265.             return $this->cashBoxOrder $this->cashBoxOrder->getEndAt() : null;
  266.     }
  267.     public function getCustomer(): ?Customer
  268.     {
  269.         return $this->customer;
  270.     }
  271.     public function setCustomer(?Customer $customer): self
  272.     {
  273.         $this->customer $customer;
  274.         return $this;
  275.     }
  276.     public function getCategoriesProduct(){
  277.         $categories = [];
  278.         foreach($this->getOrderItems() as $singleOrderItem){
  279.             if($singleOrderItem->getProduct()){
  280.                 if($singleOrderItem->getProduct()->getParentCategory()){
  281.                     $categories[] = $singleOrderItem->getProduct()->getParentCategory()->getName();
  282.                 }
  283.                 
  284.             }
  285.         }
  286.         return $categories;
  287.     }
  288.     public function getSubCategoriesProduct(){
  289.         $categories = [];
  290.         foreach($this->getOrderItems() as $singleOrderItem){
  291.             if($singleOrderItem->getProduct()){
  292.                 foreach($singleOrderItem->getProduct()->getCategoriesProduct() as $singleCategory){
  293.                     if(!in_array($singleCategory->getName(),$categories)){
  294.                         $categories[] = $singleCategory->getName();
  295.                     }
  296.                     
  297.                 }
  298.                 
  299.             }
  300.         }
  301.         return $categories;
  302.     }
  303.     /**
  304.      * @return Collection|OrderItem[]
  305.      */
  306.     public function getOrderItems(): Collection
  307.     {
  308.         return $this->orderItems;
  309.     }
  310.     public function addOrderItem(OrderItem $orderItem): self
  311.     {
  312.         if (!$this->orderItems->contains($orderItem)) {
  313.             $this->orderItems[] = $orderItem;
  314.             $orderItem->setParentOrder($this);
  315.         }
  316.         return $this;
  317.     }
  318.     public function removeOrderItem(OrderItem $orderItem): self
  319.     {
  320.         if ($this->orderItems->removeElement($orderItem)) {
  321.             // set the owning side to null (unless already changed)
  322.             if ($orderItem->getParentOrder() === $this) {
  323.                 $orderItem->setParentOrder(null);
  324.             }
  325.         }
  326.         return $this;
  327.     }
  328.     /**
  329.      * @return Collection|Adjustment[]
  330.      */
  331.     public function getAdjustments(): Collection
  332.     {
  333.         return $this->adjustments;
  334.     }
  335.     public function addAdjustment(Adjustment $adjustment): self
  336.     {
  337.         if (!$this->adjustments->contains($adjustment)) {
  338.             $this->adjustments[] = $adjustment;
  339.             $adjustment->setParentOrder($this);
  340.         }
  341.         return $this;
  342.     }
  343.     public function removeAdjustment(Adjustment $adjustment): self
  344.     {
  345.         if ($this->adjustments->removeElement($adjustment)) {
  346.             // set the owning side to null (unless already changed)
  347.             if ($adjustment->getParentOrder() === $this) {
  348.                 $adjustment->setParentOrder(null);
  349.             }
  350.         }
  351.         return $this;
  352.     }
  353.     public function getReductionOnCoupon(){
  354.         $reductionCoupon=0;
  355.         if($this->getCoupon()){
  356.             if($this->getCoupon()->getTypeReduction()=="percent"){
  357.                 $reductionCoupon = ($this->getTotalAmount()/100)*$this->getCoupon()->getValueReduction();
  358.             }else{
  359.                 $reductionCoupon $this->getCoupon()->getValueReduction();
  360.             }
  361.         }
  362.         return  $reductionCoupon;
  363.     }
  364.     public function getFirstName(): ?string
  365.     {
  366.         return $this->firstName;
  367.     }
  368.     public function setFirstName(string $firstName): self
  369.     {
  370.         $this->firstName $firstName;
  371.         return $this;
  372.     }
  373.     public function getLastName(): ?string
  374.     {
  375.         return $this->lastName;
  376.     }
  377.     public function setLastName(string $lastName): self
  378.     {
  379.         $this->lastName $lastName;
  380.         return $this;
  381.     }
  382.     public function getCompanyName(): ?string
  383.     {
  384.         return $this->companyName;
  385.     }
  386.     public function setCompanyName(?string $companyName): self
  387.     {
  388.         $this->companyName $companyName;
  389.         return $this;
  390.     }
  391.     public function getAddress(): ?string
  392.     {
  393.         return $this->address;
  394.     }
  395.     public function setAddress(string $address): self
  396.     {
  397.         $this->address $address;
  398.         return $this;
  399.     }
  400.     public function getCity(): ?string
  401.     {
  402.         return $this->city;
  403.     }
  404.     public function setCity(string $city): self
  405.     {
  406.         $this->city $city;
  407.         return $this;
  408.     }
  409.     public function getCountry(): ?string
  410.     {
  411.         return $this->country;
  412.     }
  413.     public function setCountry(string $country): self
  414.     {
  415.         $this->country $country;
  416.         return $this;
  417.     }
  418.     public function getDepartment(): ?string
  419.     {
  420.         return $this->department;
  421.     }
  422.     public function setDepartment(?string $department): self
  423.     {
  424.         $this->department $department;
  425.         return $this;
  426.     }
  427.     public function getPostcode(): ?string
  428.     {
  429.         return $this->postcode;
  430.     }
  431.     public function setPostcode(?string $postcode): self
  432.     {
  433.         $this->postcode $postcode;
  434.         return $this;
  435.     }
  436.     public function getEmail(): ?string
  437.     {
  438.         return $this->email;
  439.     }
  440.     public function setEmail(string $email): self
  441.     {
  442.         $this->email $email;
  443.         return $this;
  444.     }
  445.     public function getTel(): ?string
  446.     {
  447.         return $this->tel;
  448.     }
  449.     public function setTel(string $tel): self
  450.     {
  451.         $this->tel $tel;
  452.         return $this;
  453.     }
  454.     public function getComment(): ?string
  455.     {
  456.         return $this->comment;
  457.     }
  458.     public function setComment(?string $comment): self
  459.     {
  460.         $this->comment $comment;
  461.         return $this;
  462.     }
  463.   
  464.     #[Groups(['read'])]
  465.     public function getTotalAmount(){
  466.         $total=0;
  467.         foreach($this->orderItems as $singleOrderItem){
  468.             $total $total + ($singleOrderItem->getTotalAmount());
  469.         }
  470.         return $total;
  471.         
  472.     }
  473.     //needs optimisation
  474.     #[Groups(['read'])]
  475.     public function getShippingFees(){
  476.         $fees 0;
  477.         if($this->getShippingMethod()){
  478.             if($this->getShippingMethod()->isIsSeparatelyCalculated()){
  479.                 $fees $this->getShippingMethod()->getPrice();
  480.             
  481.                 foreach($this->getShippingMethod()->getShippingRules() as $shippingRule){
  482.     
  483.     
  484.                     if($shippingRule->getTypeCalculation() == "distance"){
  485.                         if( $shippingRule->getMin() < $this->getDistance()  and   $shippingRule->getMax() >= $this->getDistance() ){
  486.                             $fees =  $this->getDistance() * $shippingRule->getValueCalculation();
  487.     
  488.                             /*Condition for TLCS may be it works for all people*/
  489.                             if ($fees $this->getShippingMethod()->getPrice()){
  490.                                 $fees $this->getShippingMethod()->getPrice();
  491.                             }
  492.                             /*Condition for TLCS may be it works for all people*/
  493.                         }
  494.                         
  495.                     }
  496.                         else{
  497.                             if(
  498.                             $shippingRule->getMin() < $this->getTotalAmount() and $shippingRule->getMax() >=  $this->getTotalAmount()
  499.                             
  500.                             ){
  501.                                 if($shippingRule->getTypeCalculation() == "percent"){
  502.                                     $fees = ($this->getTotalAmount() / 100 ) * $shippingRule->getValueCalculation();
  503.                                 }
  504.                                 else{
  505.                                     $fees =  $shippingRule->getValueCalculation();
  506.                                 }
  507.                             }
  508.                         
  509.                     }
  510.     
  511.                     
  512.                 }
  513.             }
  514.             
  515.         }
  516.     
  517.         
  518.         
  519.         return $fees;
  520.     }
  521.     #[Groups(['read'])]
  522.     public function getTotalReduction(){
  523.         $total=0;
  524.         
  525.         foreach($this->orderItems as $singleOrderItem){
  526.             $total $total + ($singleOrderItem->getReduction());
  527.         }
  528.         return $total;
  529.     }
  530.     public function getReductionOnTotal(){
  531.         $reductionAmount 0;
  532.         
  533.         if($this->getReduction() and $this->getReduction()>0){
  534.             $reductionAmount = ($this->getTotalAmount() / 100) * $this->getReduction();
  535.         }
  536.         return $reductionAmount;
  537.     }
  538.     #[Groups(['read'])]
  539.     public function getAmountPayedByCredit(){
  540.         $total=0;
  541.         foreach($this->getCustomerWalletPoints() as $singleWalletPoints){
  542.             if($singleWalletPoints->getPoints()<0){
  543.                 $total $total + ($singleWalletPoints->getPoints());
  544.             }
  545.             
  546.         }
  547.         return $total;
  548.     }
  549.     #[Groups(['read'])]
  550.     public function getAmountEarnedAsCredit(){
  551.         $total=0;
  552.         foreach($this->getCustomerWalletPoints() as $singleWalletPoints){
  553.             if($singleWalletPoints->getPoints()>0){
  554.                 $total $total + ($singleWalletPoints->getPoints());
  555.             }
  556.             
  557.         }
  558.         return $total;
  559.     }
  560.     public function getDemandeFund(): ?DemandeFund
  561.     {
  562.         return $this->demandeFund;
  563.     }
  564.     public function setDemandeFund(?DemandeFund $demandeFund): self
  565.     {
  566.         $this->demandeFund $demandeFund;
  567.         return $this;
  568.     }
  569.     public function getStatus(): ?string
  570.     {
  571.         $status "order_finance_verification_pending";
  572.         if($this->status)
  573.         {
  574.             $status $this->status;
  575.         }
  576.         return $status;
  577.     }
  578.     public function setStatus(?string $status): self
  579.     {
  580.         $this->status $status;
  581.         return $this;
  582.     }
  583.     // BySamir : TO CLEAN
  584.  
  585.     public function getSource(): ?string
  586.     {
  587.         return $this->source;
  588.     }
  589.     public function setSource(?string $source): self
  590.     {
  591.         $this->source $source;
  592.         return $this;
  593.     }
  594.     public function getDeliveryAt()
  595.     {
  596.         return $this->deliveryAt;
  597.     }
  598.     public function setDeliveryAt($deliveryAt)
  599.     {
  600.         $this->deliveryAt $deliveryAt;
  601.         return $this;
  602.     }
  603.     public function getRecoveryAt()
  604.     {
  605.         return $this->recoveryAt;
  606.     }
  607.     public function setRecoveryAt($recoveryAt)
  608.     {
  609.         $this->recoveryAt $recoveryAt;
  610.         return $this;
  611.     }
  612.     public function getReduction(): ?float
  613.     {
  614.         return $this->reduction;
  615.     }
  616.     public function setReduction(?float $reduction): self
  617.     {
  618.         $this->reduction $reduction;
  619.         return $this;
  620.     }
  621.     public function getShippingMethod(): ?ShippingMethod
  622.     {
  623.         return $this->shippingMethod;
  624.     }
  625.     public function setShippingMethod(?ShippingMethod $shippingMethod): self
  626.     {
  627.         $this->shippingMethod $shippingMethod;
  628.         return $this;
  629.     }
  630.     public function getAgent(): ?Agent
  631.     {
  632.         return $this->agent;
  633.     }
  634.     public function setAgent(?Agent $agent): self
  635.     {
  636.         $this->agent $agent;
  637.         return $this;
  638.     }
  639.     public function getPaymentMethod(): ?paymentMethod
  640.     {
  641.         return $this->paymentMethod;
  642.     }
  643.     public function setPaymentMethod(?paymentMethod $paymentMethod): self
  644.     {
  645.         $this->paymentMethod $paymentMethod;
  646.         return $this;
  647.     }
  648.     public function getPayedAmount(): ?float
  649.     {
  650.         return $this->payedAmount;
  651.     }
  652.     public function setPayedAmount(?float $payedAmount): self
  653.     {
  654.         $this->payedAmount $payedAmount;
  655.         return $this;
  656.     }
  657.     public function getStartProcessingAt(): ?\DateTimeInterface
  658.     {
  659.         return $this->startProcessingAt;
  660.     }
  661.     public function setStartProcessingAt(?\DateTimeInterface $startProcessingAt): self
  662.     {
  663.         $this->startProcessingAt $startProcessingAt;
  664.         return $this;
  665.     }
  666.     public function getDeliveryType(): ?string
  667.     {
  668.         return $this->deliveryType;
  669.     }
  670.     public function setDeliveryType(?string $deliveryType): self
  671.     {
  672.         $this->deliveryType $deliveryType;
  673.         return $this;
  674.     }
  675.     public function getStartDeliveryAt(): ?\DateTimeInterface
  676.     {
  677.         return $this->startDeliveryAt;
  678.     }
  679.     public function setStartDeliveryAt(?\DateTimeInterface $startDeliveryAt): self
  680.     {
  681.         $this->startDeliveryAt $startDeliveryAt;
  682.         return $this;
  683.     }
  684.     /**
  685.      * @return Collection<int, CustomerWalletPoint>
  686.      */
  687.     public function getCustomerWalletPoints(): Collection
  688.     {
  689.         return $this->customerWalletPoints;
  690.     }
  691.     public function addCustomerWalletPoint(CustomerWalletPoint $customerWalletPoint): self
  692.     {
  693.         if (!$this->customerWalletPoints->contains($customerWalletPoint)) {
  694.             $this->customerWalletPoints[] = $customerWalletPoint;
  695.             $customerWalletPoint->setOriginOrder($this);
  696.         }
  697.         return $this;
  698.     }
  699.     public function removeCustomerWalletPoint(CustomerWalletPoint $customerWalletPoint): self
  700.     {
  701.         if ($this->customerWalletPoints->removeElement($customerWalletPoint)) {
  702.             // set the owning side to null (unless already changed)
  703.             if ($customerWalletPoint->getOriginOrder() === $this) {
  704.                 $customerWalletPoint->setOriginOrder(null);
  705.             }
  706.         }
  707.         return $this;
  708.     }
  709.     public function getCoupon(): ?Coupon
  710.     {
  711.         return $this->coupon;
  712.     }
  713.     public function setCoupon(?Coupon $coupon): self
  714.     {
  715.         $this->coupon $coupon;
  716.         return $this;
  717.     }
  718.     public function getAgentToDo(): ?Agent
  719.     {
  720.         return $this->agentToDo;
  721.     }
  722.     public function setAgentToDo(?Agent $agentToDo): self
  723.     {
  724.         $this->agentToDo $agentToDo;
  725.         return $this;
  726.     }
  727.     public function getIsToDo(): ?bool
  728.     {
  729.         return $this->isToDo;
  730.     }
  731.     public function setIsToDo(?bool $isToDo): self
  732.     {
  733.         $this->isToDo $isToDo;
  734.         return $this;
  735.     }
  736.     public function getCityRegionShipping(): ?CityRegion
  737.     {
  738.         return $this->cityRegionShipping;
  739.     }
  740.     public function setCityRegionShipping(?CityRegion $cityRegionShipping): self
  741.     {
  742.         $this->cityRegionShipping $cityRegionShipping;
  743.         return $this;
  744.     }
  745.     public function getVendor(): ?Vendor
  746.     {
  747.         return $this->vendor;
  748.     }
  749.     public function setVendor(?Vendor $vendor): self
  750.     {
  751.         $this->vendor $vendor;
  752.         return $this;
  753.     }
  754.     public function getCollectAddress(): ?string
  755.     {
  756.         return $this->collectAddress;
  757.     }
  758.     public function setCollectAddress(?string $collectAddress): self
  759.     {
  760.         $this->collectAddress $collectAddress;
  761.         return $this;
  762.     }
  763.     public function getCollectTel(): ?string
  764.     {
  765.         return $this->collectTel;
  766.     }
  767.     public function setCollectTel(?string $collectTel): self
  768.     {
  769.         $this->collectTel $collectTel;
  770.         return $this;
  771.     }
  772.     public function getIsHeavy(): ?bool
  773.     {
  774.         return $this->isHeavy;
  775.     }
  776.     public function setIsHeavy(?bool $isHeavy): self
  777.     {
  778.         $this->isHeavy $isHeavy;
  779.         return $this;
  780.     }
  781.     public function getShippingTips(): ?float
  782.     {
  783.         return $this->shippingTips;
  784.     }
  785.     public function setShippingTips(?float $shippingTips): self
  786.     {
  787.         $this->shippingTips $shippingTips;
  788.         return $this;
  789.     }
  790.  
  791.     
  792.     /**
  793.      * Get the value of isChecked
  794.      */ 
  795.     public function getIsChecked()
  796.     {
  797.         return $this->isChecked;
  798.     }
  799.     /**
  800.      * Set the value of isChecked
  801.      *
  802.      * @return  self
  803.      */ 
  804.     public function setIsChecked($isChecked)
  805.     {
  806.         $this->isChecked $isChecked;
  807.         return $this;
  808.     }
  809.     /**
  810.      * Get the value of walletPaymentAmount
  811.      */ 
  812.     public function getWalletPaymentAmount()
  813.     {
  814.         return $this->walletPaymentAmount;
  815.     }
  816.     /**
  817.      * Set the value of walletPaymentAmount
  818.      *
  819.      * @return  self
  820.      */ 
  821.     public function setWalletPaymentAmount($walletPaymentAmount)
  822.     {
  823.         $this->walletPaymentAmount $walletPaymentAmount;
  824.         return $this;
  825.     }
  826.     /**
  827.      * Get the value of cityRegionCollect
  828.      */ 
  829.     public function getCityRegionCollect()
  830.     {
  831.         return $this->cityRegionCollect;
  832.     }
  833.     /**
  834.      * Set the value of cityRegionCollect
  835.      *
  836.      * @return  self
  837.      */ 
  838.     public function setCityRegionCollect($cityRegionCollect)
  839.     {
  840.         $this->cityRegionCollect $cityRegionCollect;
  841.         return $this;
  842.     }
  843.     /**
  844.      * Get the value of distance
  845.      */ 
  846.     public function getDistance()
  847.     {
  848.         return $this->distance;
  849.     }
  850.     /**
  851.      * Set the value of distance
  852.      *
  853.      * @return  self
  854.      */ 
  855.     public function setDistance($distance)
  856.     {
  857.         $this->distance $distance;
  858.         return $this;
  859.     }
  860.     /**
  861.      * Get the value of tokenStripe
  862.      */ 
  863.     public function getTokenStripe()
  864.     {
  865.         return $this->tokenStripe;
  866.     }
  867.     /**
  868.      * Set the value of tokenStripe
  869.      *
  870.      * @return  self
  871.      */ 
  872.     public function setTokenStripe($tokenStripe)
  873.     {
  874.         $this->tokenStripe $tokenStripe;
  875.         return $this;
  876.     }
  877.     public function getOrderType(): ?string
  878.     {
  879.         return $this->orderType;
  880.     }
  881.     public function setOrderType(?string $orderType): self
  882.     {
  883.         $this->orderType $orderType;
  884.         return $this;
  885.     }
  886.     /**
  887.      * Get the value of deletedAt
  888.      */ 
  889.     public function getDeletedAt()
  890.     {
  891.         return $this->deletedAt;
  892.     }
  893.     /**
  894.      * Set the value of deletedAt
  895.      *
  896.      * @return  self
  897.      */ 
  898.     public function setDeletedAt($deletedAt)
  899.     {
  900.         $this->deletedAt $deletedAt;
  901.         return $this;
  902.     }
  903.     public function getStore(): ?Store
  904.     {
  905.         return $this->store;
  906.     }
  907.     public function setStore(?Store $store): self
  908.     {
  909.         $this->store $store;
  910.         return $this;
  911.     }
  912.     public function getShipment(): ?Shipment
  913.     {
  914.         return $this->shipment;
  915.     }
  916.     public function setShipment(?Shipment $shipment): self
  917.     {
  918.         $this->shipment $shipment;
  919.         return $this;
  920.     }
  921.     public function getInvoice(): ?Invoice
  922.     {
  923.         return $this->invoice;
  924.     }
  925.     public function setInvoice(?Invoice $invoice): self
  926.     {
  927.         $this->invoice $invoice;
  928.         return $this;
  929.     }
  930.     /**
  931.      * Get the value of shippingAddress
  932.      */ 
  933.     public function getShippingAddress()
  934.     {
  935.         return $this->shippingAddress;
  936.     }
  937.     /**
  938.      * Set the value of shippingAddress
  939.      *
  940.      * @return  self
  941.      */ 
  942.     public function setShippingAddress($shippingAddress)
  943.     {
  944.         $this->shippingAddress $shippingAddress;
  945.         return $this;
  946.     }
  947.     public function getCreatedBy()
  948.     {
  949.         return $this->createdBy;
  950.     }
  951.     public function getDescription(): ?string
  952.     {
  953.         return $this->description;
  954.     }
  955.     public function setDescription(?string $description): self
  956.     {
  957.         $this->description $description;
  958.         return $this;
  959.     }
  960.     /**
  961.      * @return Collection<int, Payment>
  962.      */
  963.     public function getPayments(): Collection
  964.     {
  965.         return $this->payments;
  966.     }
  967.     public function addPayment(Payment $payment): self
  968.     {
  969.         if (!$this->payments->contains($payment)) {
  970.             $this->payments->add($payment);
  971.             $payment->setRelatedOrder($this);
  972.         }
  973.         return $this;
  974.     }
  975.     public function removePayment(Payment $payment): self
  976.     {
  977.         if ($this->payments->removeElement($payment)) {
  978.             // set the owning side to null (unless already changed)
  979.             if ($payment->getRelatedOrder() === $this) {
  980.                 $payment->setRelatedOrder(null);
  981.             }
  982.         }
  983.         return $this;
  984.     }
  985.     public function getReference(): ?string
  986.     {
  987.         return $this->reference;
  988.     }
  989.     public function setReference(?string $reference): self
  990.     {
  991.         $this->reference $reference;
  992.         return $this;
  993.     }
  994.     public function getCashBoxOrder(): ?CashBoxOrder
  995.     {
  996.         return $this->cashBoxOrder;
  997.     }
  998.     public function setCashBoxOrder(?CashBoxOrder $cashBoxOrder): self
  999.     {
  1000.         $this->cashBoxOrder $cashBoxOrder;
  1001.         return $this;
  1002.     }
  1003.      public function isIsMulticlub(): ?bool
  1004.     {
  1005.         return $this->is_multiclub;
  1006.     }
  1007.     public function setIsMulticlub(?bool $is_multiclub): static
  1008.     {
  1009.         $this->is_multiclub $is_multiclub;
  1010.        if ($is_multiclub) {
  1011.         $this->is_local false;
  1012.     }
  1013.     return $this;
  1014.     }
  1015.     public function isIsLocal(): ?bool
  1016.     {
  1017.         return $this->is_local;
  1018.     }
  1019.     public function setIsLocal(?bool $is_local): static
  1020.     {
  1021.         $this->is_local $is_local;
  1022.         if ($is_local) {
  1023.         $this->is_multiclub false;
  1024.       }
  1025.     return $this;
  1026.     }
  1027.     public function getAccessChoice(): string
  1028.     {
  1029.         if ($this->is_multiclub) {
  1030.             return 'multiclub';
  1031.         }
  1032.     
  1033.         return 'local';
  1034.     }
  1035.     
  1036.     public function setAccessChoice(?string $accessChoice): self
  1037.     {
  1038.         $this->accessChoice $accessChoice;
  1039.     
  1040.         if ($accessChoice === 'multiclub') {
  1041.             $this->is_multiclub true;
  1042.             $this->is_local false;
  1043.         } else {
  1044.             $this->is_local true;
  1045.             $this->is_multiclub false;
  1046.         }
  1047.     
  1048.         return $this;
  1049.     }
  1050.     
  1051.     
  1052. }