src/Entity/Gos/ProductCart.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Entity\Gos\Uniqskills\Course;
  4. use App\Enum\DocumentDistributionChannels;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * Cart
  10.  *
  11.  * @ORM\Entity(repositoryClass="App\Repository\ProductCartRepository")
  12.  * @ORM\HasLifecycleCallbacks
  13.  */
  14. class ProductCart
  15. {
  16.     /**
  17.      * @var int
  18.      *
  19.      * @ORM\Column(name="id", type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @var int
  26.      *
  27.      * @ORM\Column(name="quantity", type="integer")
  28.      */
  29.     private $quantity;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\Cart", inversedBy="productCart", cascade={"persist"})
  32.      * @ORM\JoinColumn(onDelete="CASCADE")
  33.      */
  34.     private $cart;
  35.     /**
  36.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="productCart")
  37.      * @ORM\JoinColumn()
  38.      */
  39.     private $productVariant;
  40.     /**
  41.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\ProductPack", inversedBy="productCart")
  42.      * @ORM\JoinColumn()
  43.      */
  44.     private $productPack;
  45.     /**
  46.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\PaymentMethod", inversedBy="productCart")
  47.      * @ORM\JoinColumn()
  48.      */
  49.     private $paymentMethod;
  50.     /**
  51.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\CartParticipant", mappedBy="productCart")
  52.      */
  53.     private $cartParticipant;
  54.     /**
  55.      * @ORM\OneToOne(targetEntity="Gift", mappedBy="productCart")
  56.      */
  57.     private $gift;
  58.     /**
  59.      * @ORM\Column(type="boolean", nullable=true)
  60.      */
  61.     private $isGift;
  62.     /**
  63.      * @ORM\ManyToOne(targetEntity="Coupon", inversedBy="productCart", cascade={"persist"})
  64.      */
  65.     private $coupon;
  66.     /**
  67.      * @ORM\ManyToMany(targetEntity="Coupon", mappedBy="productCarts", cascade={"persist"})
  68.      */
  69.     private $coupons;
  70.     /**
  71.      * @ORM\ManyToOne(targetEntity="ProductAssociation", inversedBy="productCart")
  72.      * @ORM\JoinColumn()
  73.      */
  74.     private $productAssociation;
  75.     /**
  76.      * @ORM\Column(type="datetime")
  77.      */
  78.     private $createdAt;
  79.     /**
  80.      * @ORM\Column(type="datetime", nullable=true)
  81.      */
  82.     private $updatedAt;
  83.     /**
  84.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\ProductPack")
  85.      */
  86.     private $cycleProductPack;
  87.     /**
  88.      * @ORM\Column(type="boolean", nullable=true)
  89.      */
  90.     private $lifetimeLanding;
  91.     /**
  92.      * @ORM\Column(type="integer", nullable=true)
  93.      */
  94.     private $upsellingType;
  95.     /**
  96.      * @ORM\Column(type="boolean", nullable=true)
  97.      */
  98.     private $omitShippingCosts;
  99.     /**
  100.      * @ORM\ManyToOne(targetEntity=Course::class)
  101.      */
  102.     private $course;
  103.     /**
  104.      * @ORM\Column(type="integer", nullable=true)
  105.      */
  106.     private $selectedDiscount;
  107.     /**
  108.      * @ORM\ManyToOne(targetEntity=ProductCart::class, inversedBy="children")
  109.      * @ORM\JoinColumn(onDelete="CASCADE")
  110.      */
  111.     private $parent;
  112.     /**
  113.      * @ORM\OneToMany(targetEntity="ProductCart", mappedBy="parent", cascade={"persist", "remove"})
  114.      */
  115.     private $children;
  116.     /**
  117.      * @ORM\ManyToMany(targetEntity=Coupon::class, cascade={"persist"})
  118.      * @ORM\JoinTable(name="product_cart_not_combined_coupons")
  119.      */
  120.     private $notCombinedCoupons;
  121.     /**
  122.      * @ORM\Column(type="boolean", nullable=true)
  123.      */
  124.     private $productDuplicationMessageDisplayed;
  125.     public function __clone()
  126.     {
  127.         if ($this->id)
  128.         {
  129.             $this->setId(null);
  130.         }
  131.     }
  132.     public function isActive(): bool
  133.     {
  134.         if ((!empty($this->getProductVariant()) && !$this->getProductVariant()->isActive())
  135.         || (!empty($this->getProductPack() && !$this->getProductPack()->isActive())))
  136.         {
  137.             return false;
  138.         }
  139.         if (!empty($this->getProductPack()))
  140.         {
  141.             foreach ($this->getProductPack()->getProductPackItem() as $productPackItem)
  142.             {
  143.                 /** @var ProductPackItem $productPackItem */
  144.                 if (!$productPackItem->getProductVariant()->isActive())
  145.                 {
  146.                     return false;
  147.                 }
  148.             }
  149.         }
  150.         return true;
  151.     }
  152.     public function countCartParticipant(): int
  153.     {
  154.         return $this->getCartParticipant()->count();
  155.     }
  156.     public function getCartParticipantByOrder($order)
  157.     {
  158.         if (is_int($order))
  159.         {
  160.             $cartParticipant $this->getCartParticipant()->toArray();
  161.             asort($cartParticipant);
  162.             --$order;
  163.             if (isset($cartParticipant[$order]))
  164.             {
  165.                 return $cartParticipant[$order];
  166.             }
  167.         }
  168.         return null;
  169.     }
  170.     public function hasEventProduct(): bool
  171.     {
  172.         if (
  173.             !empty($this->getProductVariant())
  174.             && $this->getProductVariant()->isEvent()
  175.         )
  176.         {
  177.             return true;
  178.         }
  179.         if (!empty($this->getProductPack()))
  180.         {
  181.             foreach ($this->getProductPack()->getProductPackItem() as $productPackItem)
  182.             {
  183.                 /** @var ProductPackItem $productPackItem */
  184.                 if ($productPackItem->getProductVariant()->isEvent())
  185.                 {
  186.                     return true;
  187.                 }
  188.             }
  189.         }
  190.         return false;
  191.     }
  192.     public function hasEventProductTaxFree(): bool
  193.     {
  194.         if (
  195.             !empty($this->getProductVariant())
  196.             && $this->getProductVariant()->isEvent() && $this->getProductVariant()->getTaxFreeForBudgetUnit()
  197.         )
  198.         {
  199.             return true;
  200.         }
  201.         if (!empty($this->getProductPack()))
  202.         {
  203.             foreach ($this->getProductPack()->getProductPackItem() as $productPackItem)
  204.             {
  205.                 /** @var ProductPackItem $productPackItem */
  206.                 if ($productPackItem->getProductVariant()->isEvent() && $productPackItem->getProductVariant()->getTaxFreeForBudgetUnit())
  207.                 {
  208.                     return true;
  209.                 }
  210.             }
  211.         }
  212.         return false;
  213.     }
  214.     public function hasOnlyEventProduct(): bool
  215.     {
  216.         if (
  217.             !empty($this->getProductVariant())
  218.             && !$this->getProductVariant()->isEvent()
  219.         )
  220.         {
  221.             return false;
  222.         }
  223.         if (!empty($this->getProductPack()))
  224.         {
  225.             foreach ($this->getProductPack()->getProductPackItem() as $productPackItem)
  226.             {
  227.                 /** @var ProductPackItem $productPackItem */
  228.                 if (!$productPackItem->getProductVariant()->isEvent())
  229.                 {
  230.                     return false;
  231.                 }
  232.             }
  233.         }
  234.         if (!empty($this->getCartParticipant()))
  235.         {
  236.             foreach ($this->getCartParticipant() as $cartParticipant)
  237.             {
  238.                 if (!empty($cartParticipant->getProductVariantGroupItems()))
  239.                 {
  240.                     foreach ($cartParticipant->getProductVariantGroupItems() as $productVariantGroupItem)
  241.                     {
  242.                         if (!$productVariantGroupItem->getProductVariant()->isEvent())
  243.                         {
  244.                             return false;
  245.                         }
  246.                     }
  247.                 }
  248.             }
  249.         }
  250.         return true;
  251.     }
  252.     public function hasProductPack(): bool
  253.     {
  254.         return !empty($this->getProductPack());
  255.     }
  256.     public function hasUniqskillsMultiUserCourse(): bool
  257.     {
  258.         return $this->getProductVariant() !== null
  259.             && $this->getProductVariant()->getIsUniqskillsProduct()
  260.             && $this->getProductVariant()->getMaxUsers() > 1
  261.             && $this->getProductVariant()->getBuyMaxOne() === false
  262.             && $this->getQuantity() > 1;
  263.     }
  264.     public function __construct()
  265.     {
  266.         $this->cartParticipant = new ArrayCollection();
  267.         $this->coupons         = new ArrayCollection();
  268.         $this->children        = new ArrayCollection();
  269.         $this->notCombinedCoupons = new ArrayCollection();
  270.     }
  271.     public function __toString()
  272.     {
  273.         return (string)$this->id;
  274.     }
  275.     /** @ORM\PrePersist() */
  276.     public function prePersist()
  277.     {
  278.         $this->createdAt = new \DateTime();
  279.     }
  280.     /** @ORM\PreUpdate() */
  281.     public function preUpdate()
  282.     {
  283.         $this->updatedAt = new \DateTime();
  284.     }
  285.     //------------------------------ setters & getters
  286.     /**
  287.      * Get id
  288.      *
  289.      * @return int
  290.      */
  291.     public function getId()
  292.     {
  293.         return $this->id;
  294.     }
  295.     /**
  296.      * Set id
  297.      *
  298.      * @return ProductCart
  299.      */
  300.     public function setId($id)
  301.     {
  302.         $this->id $id;
  303.         return $this;
  304.     }
  305.     /**
  306.      * Get quantity
  307.      *
  308.      * @return integer
  309.      */
  310.     public function getQuantity()
  311.     {
  312.         return $this->quantity;
  313.     }
  314.     /**
  315.      * Set createdAt
  316.      *
  317.      * @param \DateTime $createdAt
  318.      *
  319.      * @return ProductCart
  320.      */
  321.     public function setCreatedAt($createdAt)
  322.     {
  323.         $this->createdAt $createdAt;
  324.         return $this;
  325.     }
  326.     /**
  327.      * Get createdAt
  328.      *
  329.      * @return \DateTime
  330.      */
  331.     public function getCreatedAt()
  332.     {
  333.         return $this->createdAt;
  334.     }
  335.     /**
  336.      * Set updatedAt
  337.      *
  338.      * @param \DateTime $updatedAt
  339.      *
  340.      * @return ProductCart
  341.      */
  342.     public function setUpdatedAt($updatedAt)
  343.     {
  344.         $this->updatedAt $updatedAt;
  345.         return $this;
  346.     }
  347.     /**
  348.      * Get updatedAt
  349.      *
  350.      * @return \DateTime
  351.      */
  352.     public function getUpdatedAt()
  353.     {
  354.         return $this->updatedAt;
  355.     }
  356.     /**
  357.      * Set cart
  358.      *
  359.      * @param \App\Entity\Gos\Cart $cart
  360.      *
  361.      * @return ProductCart
  362.      */
  363.     public function setCart(\App\Entity\Gos\Cart $cart null)
  364.     {
  365.         $this->cart $cart;
  366.         return $this;
  367.     }
  368.     /**
  369.      * Get cart
  370.      *
  371.      * @return \App\Entity\Gos\Cart
  372.      */
  373.     public function getCart()
  374.     {
  375.         return $this->cart;
  376.     }
  377.     /**
  378.      * Set paymentMethod
  379.      *
  380.      * @param \App\Entity\Gos\PaymentMethod $paymentMethod
  381.      *
  382.      * @return ProductCart
  383.      */
  384.     public function setPaymentMethod(\App\Entity\Gos\PaymentMethod $paymentMethod null)
  385.     {
  386.         $this->paymentMethod $paymentMethod;
  387.         return $this;
  388.     }
  389.     /**
  390.      * Get paymentMethod
  391.      *
  392.      * @return \App\Entity\Gos\PaymentMethod
  393.      */
  394.     public function getPaymentMethod()
  395.     {
  396.         return $this->paymentMethod;
  397.     }
  398.     public function getAvailablePaymentMethods()
  399.     {
  400.         $paymentMethods = [];
  401.         if ($this->getProductVariant())
  402.         {
  403.             $additionalOptionsByClientType $this->getProductVariant()
  404.                 ->getAdditionalOptionsByClientType($this->getCart()->getClientType());
  405.             if ($additionalOptionsByClientType)
  406.             {
  407.                 foreach ($additionalOptionsByClientType->getPaymentMethod() as $paymentMethod)
  408.                 {
  409.                     $paymentMethods[] = $paymentMethod;
  410.                 }
  411.             }
  412.         }
  413.         elseif ($this->getProductPack())
  414.         {
  415.             /** @var ProductPackItem $productPackItem */
  416.             foreach ($this->getProductPack()->getProductPackItem() as $productPackItem)
  417.             {
  418.                 $additionalOptionsByClientType $productPackItem->getProductVariant()
  419.                     ->getAdditionalOptionsByClientType($this->getCart()->getClientType());
  420.                 if ($additionalOptionsByClientType)
  421.                 {
  422.                     foreach ($additionalOptionsByClientType->getPaymentMethod() as $paymentMethod)
  423.                     {
  424.                         $paymentMethods[] = $paymentMethod;
  425.                     }
  426.                 }
  427.             }
  428.         }
  429.         return $paymentMethods;
  430.     }
  431.     public function getAvailableClientTypes()
  432.     {
  433.         $clientTypes = [];
  434.         $clientTypes['quantity'] = 0;
  435.         $clientTypes['types'] = [];
  436.         if ($this->getProductVariant())
  437.         {
  438.             $clientTypes['quantity'] = 1;
  439.             $this->getClientTypes($this->productVariant$clientTypes);
  440.         }
  441.         elseif ($this->getProductPack())
  442.         {
  443.             /** @var ProductPackItem $productPackItem */
  444.             foreach ($this->getProductPack()->getProductPackItem() as $productPackItem)
  445.             {
  446.                 if ($productPackItem->getProductVariant() !== null)
  447.                 {
  448.                     $this->getClientTypes($productPackItem->getProductVariant(), $clientTypes);
  449.                     $clientTypes['quantity'] += 1;
  450.                 }
  451.             }
  452.         }
  453.         return $clientTypes;
  454.     }
  455.     private function getClientTypes(ProductVariant $productVariant, &$clientTypes): void
  456.     {
  457.         foreach ($productVariant->getAdditionalOptionsByClientTypes() as $additionalOptionsByClientType)
  458.         {
  459.             if ($additionalOptionsByClientType->getIsActive() === true)
  460.             {
  461.                 $clientTypes['types'][] = $additionalOptionsByClientType->getClientType();
  462.             }
  463.         }
  464.     }
  465.     public function setQuantity(int $quantity): self
  466.     {
  467.         $this->quantity $quantity;
  468.         return $this;
  469.     }
  470.     public function getProductVariant(): ?ProductVariant
  471.     {
  472.         return $this->productVariant;
  473.     }
  474.     public function setProductVariant(?ProductVariant $productVariant): self
  475.     {
  476.         $this->productVariant $productVariant;
  477.         return $this;
  478.     }
  479.     public function getRequiredPWZ(): ?bool
  480.     {
  481.         if ($this->getProductVariant() !== null)
  482.         {
  483.             return $this->getProductVariant()->getRequiredPWZ();
  484.         }
  485.         return false;
  486.     }
  487.     public function isNPWZRequired(): ?bool
  488.     {
  489.         if (!empty($this->productVariant)) {
  490.             return $this->getProductVariant()->getIsNPWZRequired() && $this->getProductVariant()->getRequiredPWZ();
  491.         }
  492.         if (!empty($this->productPack)) {
  493.             return $this->getProductPack()->isNPWZRequired();
  494.         }
  495.         return false;
  496.     }
  497.     public function getEmailInvoiceEnabled(): ?bool
  498.     {
  499.         if (
  500.             $this->getProductVariant() !== null
  501.             &&
  502.             $this->getProductVariant()->getDocumentDistributionChannel()
  503.             &&
  504.             $this->getProductVariant()->getDocumentDistributionChannel() != DocumentDistributionChannels::PAPER
  505.         )
  506.         {
  507.             return true;
  508.         }
  509.         if ($productPack $this->getProductPack())
  510.         {
  511.             $productPackInvoiceE true;
  512.             foreach ($productPack->getProductPackItem() as $productPackItem)
  513.             {
  514.                 if ($productPackItem->getProductVariant()->getDocumentDistributionChannel() != DocumentDistributionChannels::EMAIL)
  515.                 {
  516.                     $productPackInvoiceE false;
  517.                 }
  518.             }
  519.             if ($productPackInvoiceE == true) return true;
  520.         }
  521.         return false;
  522.     }
  523.     public function getProductPack(): ?ProductPack
  524.     {
  525.         return $this->productPack;
  526.     }
  527.     public function setProductPack(?ProductPack $productPack): self
  528.     {
  529.         $this->productPack $productPack;
  530.         return $this;
  531.     }
  532.     /**
  533.      * @return Collection|CartParticipant[]
  534.      */
  535.     public function getCartParticipant(): Collection
  536.     {
  537.         return $this->cartParticipant;
  538.     }
  539.     public function addCartParticipant(CartParticipant $cartParticipant): self
  540.     {
  541.         if (!$this->cartParticipant->contains($cartParticipant)) {
  542.             $this->cartParticipant[] = $cartParticipant;
  543.             $cartParticipant->setProductCart($this);
  544.         }
  545.         return $this;
  546.     }
  547.     public function removeCartParticipant(CartParticipant $cartParticipant): self
  548.     {
  549.         if ($this->cartParticipant->contains($cartParticipant)) {
  550.             $this->cartParticipant->removeElement($cartParticipant);
  551.             // set the owning side to null (unless already changed)
  552.             if ($cartParticipant->getProductCart() === $this) {
  553.                 $cartParticipant->setProductCart(null);
  554.             }
  555.         }
  556.         return $this;
  557.     }
  558.     public function removeAllCartParticipants(): self
  559.     {
  560.         $this->cartParticipant = new ArrayCollection();
  561.         return $this;
  562.     }
  563.     public function getGift(): ?Gift
  564.     {
  565.         return $this->gift;
  566.     }
  567.     public function setGift(?Gift $gift): self
  568.     {
  569.         $this->gift $gift;
  570.         // set (or unset) the owning side of the relation if necessary
  571.         $newProductCart $gift === null null $this;
  572.         if ($newProductCart !== $gift->getProductCart()) {
  573.             $gift->setProductCart($newProductCart);
  574.         }
  575.         return $this;
  576.     }
  577.     public function getIsGift(): ?bool
  578.     {
  579.         return $this->isGift;
  580.     }
  581.     public function setIsGift(?bool $isGift): self
  582.     {
  583.         $this->isGift $isGift;
  584.         return $this;
  585.     }
  586.     public function getName()
  587.     {
  588.         if ($this->getProductVariant() === null && $this->getProductPack() === null)
  589.         {
  590.             return '';
  591.         }
  592.         if ($this->getProductPack())
  593.         {
  594.             return $this->getProductPack()->getName();
  595.         }
  596.         if ($this->getCycleProductPack())
  597.         {
  598.             return $this->getCycleProductPack()->getLabel();
  599.         }
  600.         return $this->getProductVariant()->getAltTradeName() ?: $this->getProductVariant()->getTradeName();
  601.     }
  602.     public function getLabel()
  603.     {
  604.         if (!empty($this->productVariant))
  605.         {
  606.             return $this->getProductVariant()->getLabel();
  607.         }
  608.         elseif (!empty($this->productPack))
  609.         {
  610.             return $this->getProductPack()->getLabel();
  611.         }
  612.         return '';
  613.     }
  614.     public function getBuyMaxOne()
  615.     {
  616.         if (!empty($this->productVariant))
  617.         {
  618.             return $this->getProductVariant()->getBuyMaxOne();
  619.         }
  620.         elseif (!empty($this->productPack))
  621.         {
  622.             return $this->getProductPack()->getBuyMaxOne();
  623.         }
  624.         return false;
  625.     }
  626.     public function getIsEvent()
  627.     {
  628.         if (!empty($this->productVariant))
  629.         {
  630.             return $this->getProductVariant()->isEvent();
  631.         }
  632.         return false;
  633.     }
  634.     /**
  635.      * @deprecated Please use function getCoupons
  636.      */
  637.     public function getCoupon(): ?Coupon
  638.     {
  639.         if ($this->coupons->isEmpty())
  640.         {
  641.             return $this->coupon;
  642.         }
  643.         return $this->coupons->first();
  644.     }
  645.     public function getCoupons(): Collection
  646.     {
  647.         return $this->coupons;
  648.     }
  649.     /**
  650.      * @deprecated Please use function addCoupon
  651.      */
  652.     public function setCoupon(?Coupon $coupon): self
  653.     {
  654.         if ($this->coupon !== null && $this->coupons->contains($this->coupon))
  655.         {
  656.             $this->coupons->removeElement($this->coupon);
  657.             $this->coupon->removeProductCarts($this);
  658.         }
  659.         if ($coupon !== null && !$this->coupons->contains($coupon))
  660.         {
  661.             $this->coupons->add($coupon);
  662.             $coupon->addProductCarts($this);
  663.         }
  664.         $this->coupon $coupon;
  665.         return $this;
  666.     }
  667.     public function setCoupons(Collection $coupons): self
  668.     {
  669.         if ($coupons->isEmpty())
  670.         {
  671.             $this->coupon null;
  672.         }
  673.         /** @var Coupon $coupon */
  674.         foreach ($this->coupons as $coupon) {
  675.             $coupon->removeProductCarts($this);
  676.         }
  677.         $this->coupons $coupons;
  678.         /** @var Coupon $coupon */
  679.         foreach ($coupons as $coupon) {
  680.             $coupon->addProductCarts($this);
  681.         }
  682.         return $this;
  683.     }
  684.     public function addCoupon(Coupon $coupon): self
  685.     {
  686.         if (!$this->coupons->contains($coupon))
  687.         {
  688.             $this->coupons->add($coupon);
  689.             $coupon->addProductCarts($this);
  690.         }
  691.         return $this;
  692.     }
  693.     public function removeCoupon(Coupon $coupon): self
  694.     {
  695.         if ($this->coupons->contains($coupon))
  696.         {
  697.             $this->coupons->removeElement($coupon);
  698.             $coupon->removeProductCarts($this);
  699.         }
  700.         if ($this->coupon === $coupon)
  701.         {
  702.             $this->coupon null;
  703.         }
  704.         return $this;
  705.     }
  706.     public function getProductAssociation(): ?ProductAssociation
  707.     {
  708.         return $this->productAssociation;
  709.     }
  710.     public function setProductAssociation(?ProductAssociation $productAssociation): self
  711.     {
  712.         $this->productAssociation $productAssociation;
  713.         return $this;
  714.     }
  715.     public function getCycleProductPack(): ?ProductPack
  716.     {
  717.         return $this->cycleProductPack;
  718.     }
  719.     public function setCycleProductPack(?ProductPack $cycleProductPack): self
  720.     {
  721.         $this->cycleProductPack $cycleProductPack;
  722.         return $this;
  723.     }
  724.     public function findCyclePosition()
  725.     {
  726.         return $this->cycleProductPack->findCyclePosition($this->productVariant);
  727.     }
  728.     public function getLifetimeLanding(): ?bool
  729.     {
  730.         return $this->lifetimeLanding;
  731.     }
  732.     public function setLifetimeLanding(?bool $lifetimeLanding): self
  733.     {
  734.         $this->lifetimeLanding $lifetimeLanding;
  735.         return $this;
  736.     }
  737.     public function askForPWZ(): bool
  738.     {
  739.         if (!empty($this->productVariant)) {
  740.             return (bool)$this->getProductVariant()->getRequiredPWZ();
  741.         }
  742.         if (!empty($this->productPack)) {
  743.             return $this->getProductPack()->askForPWZ();
  744.         }
  745.         return false;
  746.     }
  747.     public function getUpsellingType(): ?int
  748.     {
  749.         return $this->upsellingType;
  750.     }
  751.     public function setUpsellingType(?int $upsellingType): self
  752.     {
  753.         $this->upsellingType $upsellingType;
  754.         return $this;
  755.     }
  756.     public function getOmitShippingCosts(): ?bool
  757.     {
  758.         return $this->omitShippingCosts;
  759.     }
  760.     public function setOmitShippingCosts(?bool $omitShippingCosts): self
  761.     {
  762.         $this->omitShippingCosts $omitShippingCosts;
  763.         return $this;
  764.     }
  765.     public function getCourse(): ?Course
  766.     {
  767.         return $this->course;
  768.     }
  769.     public function setCourse(?Course $course): self
  770.     {
  771.         $this->course $course;
  772.         return $this;
  773.     }
  774.     public function getSelectedDiscount(): ?int
  775.     {
  776.         return $this->selectedDiscount;
  777.     }
  778.     public function setSelectedDiscount(?int $selectedDiscount): self
  779.     {
  780.         $this->selectedDiscount $selectedDiscount;
  781.         return $this;
  782.     }
  783.     public function getParent(): ?self
  784.     {
  785.         return $this->parent;
  786.     }
  787.     public function setParent(?self $parent): self
  788.     {
  789.         $this->parent $parent;
  790.         return $this;
  791.     }
  792.     public function getChildren(): Collection
  793.     {
  794.         return $this->children;
  795.     }
  796.     public function addChildren(ProductCart $productCart): self
  797.     {
  798.         if (!$this->children->contains($productCart)) {
  799.             $this->children[] = $productCart;
  800.             $productCart->setParent($this);
  801.         }
  802.         return $this;
  803.     }
  804.     public function removeChildren(ProductCart $productCart): self
  805.     {
  806.         if ($this->children->contains($productCart)) {
  807.             $this->children->removeElement($productCart);
  808.             // set the owning side to null (unless already changed)
  809.             if ($productCart->getChildren() === $this) {
  810.                 $productCart->setParent(null);
  811.             }
  812.         }
  813.         return $this;
  814.     }
  815.     /**
  816.      * @return Collection|Coupon[]
  817.      */
  818.     public function getNotCombinedCoupons(): Collection
  819.     {
  820.         return $this->notCombinedCoupons;
  821.     }
  822.     public function addNotCombinedCoupon(Coupon $notCombinedCoupon): self
  823.     {
  824.         if (!$this->notCombinedCoupons->contains($notCombinedCoupon)) {
  825.             $this->notCombinedCoupons[] = $notCombinedCoupon;
  826.         }
  827.         return $this;
  828.     }
  829.     public function removeNotCombinedCoupon(Coupon $notCombinedCoupon): self
  830.     {
  831.         if ($this->notCombinedCoupons->contains($notCombinedCoupon)) {
  832.             $this->notCombinedCoupons->removeElement($notCombinedCoupon);
  833.         }
  834.         return $this;
  835.     }
  836.     public function getProductDuplicationMessageDisplayed(): ?bool
  837.     {
  838.         return $this->productDuplicationMessageDisplayed;
  839.     }
  840.     public function setProductDuplicationMessageDisplayed(?bool $productDuplicationMessageDisplayed): self
  841.     {
  842.         $this->productDuplicationMessageDisplayed $productDuplicationMessageDisplayed;
  843.         return $this;
  844.     }
  845. }