src/Entity/System/Cart.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\ORM\Mapping\JoinColumn;
  6. use Doctrine\ORM\Mapping\OneToOne;
  7. /**
  8.  * Cart
  9.  *
  10.  * @ORM\Table(name="ps_cart")
  11.  *
  12.  * @ORM\Entity(repositoryClass="App\Repository\System\CartRepository")
  13.  */
  14. class Cart
  15. {
  16.     public const DEFAULT_CURRENCY_EUR 1;
  17.     /**
  18.      * @var int
  19.      *
  20.      * @ORM\Id
  21.      *
  22.      * @ORM\GeneratedValue(strategy="AUTO")
  23.      *
  24.      * @ORM\Column(type="integer", name="id_cart")
  25.      */
  26.     private $id;
  27.     /**
  28.      * One Cart has One Order.
  29.      *
  30.      * @var Order|null
  31.      *
  32.      * @OneToOne(targetEntity="App\Entity\System\Order", inversedBy="cart")
  33.      *
  34.      * @JoinColumn(name="id_order", referencedColumnName="id_order", nullable=true)
  35.      */
  36.     private $order;
  37.     /**
  38.      * @var int
  39.      *
  40.      * @ORM\Column(type="integer", length=10, name="id_carrier")
  41.      */
  42.     private $carrierId;
  43.     /**
  44.      * @var string
  45.      *
  46.      * @ORM\Column(type="string", length=1000)
  47.      */
  48.     private $deliveryOption;
  49.     /**
  50.      * @var int
  51.      *
  52.      * @ORM\Column(type="integer", length=10, name="id_lang")
  53.      */
  54.     private $LanguageId;
  55.     /**
  56.      * @var int
  57.      *
  58.      * @ORM\Column(type="integer", length=10, name="id_address_delivery")
  59.      */
  60.     private $addressDeliveryId;
  61.     /**
  62.      * @var int
  63.      *
  64.      * @ORM\Column(type="integer", length=10, name="id_address_invoice")
  65.      */
  66.     private $addressInvoiceId;
  67.     /**
  68.      * @var int
  69.      *
  70.      * @ORM\Column(type="integer", length=10, name="id_currency")
  71.      */
  72.     private $currencyId;
  73.     /**
  74.      * @var int
  75.      *
  76.      * @ORM\Column(type="integer", length=10, name="id_customer")
  77.      */
  78.     private $customerId;
  79.     /**
  80.      * @var int
  81.      *
  82.      * @ORM\Column(type="integer", length=10, name="id_guest")
  83.      */
  84.     private $guestId;
  85.     /**
  86.      * @var string|null
  87.      *
  88.      * @ORM\Column(type="string", length=32, nullable=true, options={"default" : "-1"})
  89.      */
  90.     private $secureKey;
  91.     /**
  92.      * @var int
  93.      *
  94.      * @ORM\Column(type="boolean", columnDefinition="tinyint(1)", options={"default" : 1})
  95.      */
  96.     private $recyclable;
  97.     /**
  98.      * @var \DateTime
  99.      *
  100.      * @ORM\Column(type="datetime")
  101.      */
  102.     private $dateUpd;
  103.     /**
  104.      * @var \DateTime
  105.      *
  106.      * @ORM\Column(type="datetime")
  107.      */
  108.     private $dateAdd;
  109.     /**
  110.      * @var int
  111.      *
  112.      * @ORM\Column(type="boolean", columnDefinition="tinyint(1)", options={"default" : 0}, name="is_virtual")
  113.      */
  114.     private $virtual;
  115.     /**
  116.      * @var bool
  117.      *
  118.      * @ORM\Column(type="boolean", columnDefinition="tinyint(4)", options={"default" : 0}, name="is_sync")
  119.      */
  120.     private bool $sync;
  121.     /**
  122.      * @var int
  123.      *
  124.      * @ORM\Column(type="integer", length=11, options={"default" : 0}, name="id_sincronate_shop_configuration")
  125.      */
  126.     private $sincronateShopConfigurationId;
  127.     /**
  128.      * @var int|null
  129.      *
  130.      * @ORM\Column(type="boolean", columnDefinition="tinyint(1)", options={"default" : 0}, name="is_mobile", nullable=true)
  131.      */
  132.     private $mobile;
  133.     /**
  134.      * @var int|null
  135.      *
  136.      * @ORM\Column(type="boolean", columnDefinition="tinyint(1)", options={"default" : 0}, nullable=true)
  137.      */
  138.     private $dropshipping;
  139.     /**
  140.      * @var string|null
  141.      *
  142.      * @ORM\Column(type="string", nullable=true)
  143.      */
  144.     private $payment;
  145.     /**
  146.      * @var float|null
  147.      *
  148.      * @ORM\Column(type="float", columnDefinition="decimal(17,2)", options={"default" : 0.00}, nullable=true)
  149.      */
  150.     private $totalProducts;
  151.     /**
  152.      * @var float|null
  153.      *
  154.      * @ORM\Column(type="float", columnDefinition="decimal(17,2)", options={"default" : 0.00}, nullable=true, name="total_envio")
  155.      */
  156.     private $totalShipping;
  157.     /**
  158.      * @ORM\Column(type="float", nullable=true, name="logistic_weight")
  159.      */
  160.     private ?float $logisticWeight;
  161.     /**
  162.      * @var CartProduct[]|ArrayCollection
  163.      *
  164.      * @ORM\OneToMany(targetEntity="CartProduct", mappedBy="cart", cascade={"persist"})
  165.      */
  166.     private $cartProducts;
  167.     public function __construct()
  168.     {
  169.         $this->addressDeliveryId 0;
  170.         $this->addressInvoiceId 0;
  171.         $this->carrierId 0;
  172.         $this->currencyId 0;
  173.         $this->guestId 0;
  174.         $this->recyclable false;
  175.         $this->sync false;
  176.         $this->sincronateShopConfigurationId 0;
  177.         $this->cartProducts = new ArrayCollection();
  178.     }
  179.     /**
  180.      * @return int
  181.      */
  182.     public function getId(): int
  183.     {
  184.         return $this->id;
  185.     }
  186.     /**
  187.      * @param int $id
  188.      *
  189.      * @return Cart
  190.      */
  191.     public function setIdCart(int $id): self
  192.     {
  193.         $this->id $id;
  194.         return $this;
  195.     }
  196.     /**
  197.      * @return Order|null
  198.      */
  199.     public function getOrder(): ?Order
  200.     {
  201.         return $this->order;
  202.     }
  203.     /**
  204.      * @param Order|null $order
  205.      *
  206.      * @return Cart
  207.      */
  208.     public function setOrder(?Order $order): self
  209.     {
  210.         $this->order $order;
  211.         return $this;
  212.     }
  213.     /**
  214.      * @return int
  215.      */
  216.     public function getCarrierId(): int
  217.     {
  218.         return $this->carrierId;
  219.     }
  220.     /**
  221.      * @param int $carrierId
  222.      *
  223.      * @return Cart
  224.      */
  225.     public function setCarrierId(int $carrierId): self
  226.     {
  227.         $this->carrierId $carrierId;
  228.         return $this;
  229.     }
  230.     /**
  231.      * @return string
  232.      */
  233.     public function getDeliveryOption(): string
  234.     {
  235.         return $this->deliveryOption;
  236.     }
  237.     /**
  238.      * @param string $deliveryOption
  239.      *
  240.      * @return Cart
  241.      */
  242.     public function setDeliveryOption(string $deliveryOption): self
  243.     {
  244.         $this->deliveryOption $deliveryOption;
  245.         return $this;
  246.     }
  247.     /**
  248.      * @return int
  249.      */
  250.     public function getLanguageId(): int
  251.     {
  252.         return $this->LanguageId;
  253.     }
  254.     /**
  255.      * @param int $LanguageId
  256.      *
  257.      * @return Cart
  258.      */
  259.     public function setLanguageId(int $LanguageId): self
  260.     {
  261.         $this->LanguageId $LanguageId;
  262.         return $this;
  263.     }
  264.     /**
  265.      * @return int|null
  266.      */
  267.     public function getAddressDeliveryId(): ?int
  268.     {
  269.         return $this->addressDeliveryId;
  270.     }
  271.     /**
  272.      * @param int $addressDeliveryId
  273.      *
  274.      * @return Cart
  275.      */
  276.     public function setAddressDeliveryId(int $addressDeliveryId): self
  277.     {
  278.         $this->addressDeliveryId $addressDeliveryId;
  279.         return $this;
  280.     }
  281.     /**
  282.      * @return int|null
  283.      */
  284.     public function getAddressInvoiceId(): ?int
  285.     {
  286.         return $this->addressInvoiceId;
  287.     }
  288.     /**
  289.      * @param int $addressInvoiceId
  290.      *
  291.      * @return Cart
  292.      */
  293.     public function setAddressInvoiceId(int $addressInvoiceId): self
  294.     {
  295.         $this->addressInvoiceId $addressInvoiceId;
  296.         return $this;
  297.     }
  298.     /**
  299.      * @return int
  300.      */
  301.     public function getCurrencyId(): int
  302.     {
  303.         return $this->currencyId;
  304.     }
  305.     /**
  306.      * @param int $currencyId
  307.      *
  308.      * @return Cart
  309.      */
  310.     public function setCurrencyId(int $currencyId): self
  311.     {
  312.         $this->currencyId $currencyId;
  313.         return $this;
  314.     }
  315.     /**
  316.      * @return int
  317.      */
  318.     public function getCustomerId(): int
  319.     {
  320.         return $this->customerId;
  321.     }
  322.     /**
  323.      * @param int $customerId
  324.      *
  325.      * @return Cart
  326.      */
  327.     public function setCustomerId(int $customerId): self
  328.     {
  329.         $this->customerId $customerId;
  330.         return $this;
  331.     }
  332.     /**
  333.      * @return int
  334.      */
  335.     public function getGuestId(): int
  336.     {
  337.         return $this->guestId;
  338.     }
  339.     /**
  340.      * @param int $guestId
  341.      *
  342.      * @return Cart
  343.      */
  344.     public function setGuestId(int $guestId): self
  345.     {
  346.         $this->guestId $guestId;
  347.         return $this;
  348.     }
  349.     /**
  350.      * @return string|null
  351.      */
  352.     public function getSecureKey(): ?string
  353.     {
  354.         return $this->secureKey;
  355.     }
  356.     /**
  357.      * @param string|null $secureKey
  358.      *
  359.      * @return Cart
  360.      */
  361.     public function setSecureKey(?string $secureKey): self
  362.     {
  363.         $this->secureKey $secureKey;
  364.         return $this;
  365.     }
  366.     /**
  367.      * @return int
  368.      */
  369.     public function getRecyclable(): int
  370.     {
  371.         return $this->recyclable;
  372.     }
  373.     /**
  374.      * @param int $recyclable
  375.      *
  376.      * @return Cart
  377.      */
  378.     public function setRecyclable(int $recyclable): self
  379.     {
  380.         $this->recyclable $recyclable;
  381.         return $this;
  382.     }
  383.     /**
  384.      * @return \DateTime
  385.      */
  386.     public function getDateUpd(): \DateTime
  387.     {
  388.         return $this->dateUpd;
  389.     }
  390.     /**
  391.      * @param \DateTime $dateUpd
  392.      *
  393.      * @return Cart
  394.      */
  395.     public function setDateUpd(\DateTime $dateUpd): self
  396.     {
  397.         $this->dateUpd $dateUpd;
  398.         return $this;
  399.     }
  400.     /**
  401.      * @return \DateTime
  402.      */
  403.     public function getDateAdd(): \DateTime
  404.     {
  405.         return $this->dateAdd;
  406.     }
  407.     /**
  408.      * @param \DateTime $dateAdd
  409.      *
  410.      * @return Cart
  411.      */
  412.     public function setDateAdd(\DateTime $dateAdd): self
  413.     {
  414.         $this->dateAdd $dateAdd;
  415.         return $this;
  416.     }
  417.     /**
  418.      * @return int
  419.      */
  420.     public function getVirtual(): int
  421.     {
  422.         return $this->virtual;
  423.     }
  424.     /**
  425.      * @param int $virtual
  426.      *
  427.      * @return Cart
  428.      */
  429.     public function setVirtual(int $virtual): self
  430.     {
  431.         $this->virtual $virtual;
  432.         return $this;
  433.     }
  434.     /**
  435.      * @return bool
  436.      */
  437.     public function getSync(): bool
  438.     {
  439.         return $this->sync;
  440.     }
  441.     /**
  442.      * @param bool $sync
  443.      *
  444.      * @return Cart
  445.      */
  446.     public function setSync(bool $sync): self
  447.     {
  448.         $this->sync $sync;
  449.         return $this;
  450.     }
  451.     /**
  452.      * @return int
  453.      */
  454.     public function getSincronateShopConfigurationId(): int
  455.     {
  456.         return $this->sincronateShopConfigurationId;
  457.     }
  458.     /**
  459.      * @param int $sincronateShopConfigurationId
  460.      *
  461.      * @return Cart
  462.      */
  463.     public function setSincronateShopConfigurationId(int $sincronateShopConfigurationId): self
  464.     {
  465.         $this->sincronateShopConfigurationId $sincronateShopConfigurationId;
  466.         return $this;
  467.     }
  468.     /**
  469.      * @return int|null
  470.      */
  471.     public function getMobile(): ?int
  472.     {
  473.         return $this->mobile;
  474.     }
  475.     /**
  476.      * @param int|null $mobile
  477.      *
  478.      * @return Cart
  479.      */
  480.     public function setMobile(?int $mobile): self
  481.     {
  482.         $this->mobile $mobile;
  483.         return $this;
  484.     }
  485.     /**
  486.      * @return int|null
  487.      */
  488.     public function getDropshipping(): ?int
  489.     {
  490.         return $this->dropshipping;
  491.     }
  492.     /**
  493.      * @param int|null $dropshipping
  494.      *
  495.      * @return Cart
  496.      */
  497.     public function setDropshipping(?int $dropshipping): self
  498.     {
  499.         $this->dropshipping $dropshipping;
  500.         return $this;
  501.     }
  502.     /**
  503.      * @return string|null
  504.      */
  505.     public function getPayment(): ?string
  506.     {
  507.         return $this->payment;
  508.     }
  509.     /**
  510.      * @param string|null $payment
  511.      *
  512.      * @return Cart
  513.      */
  514.     public function setPayment(?string $payment): self
  515.     {
  516.         $this->payment $payment;
  517.         return $this;
  518.     }
  519.     /**
  520.      * @return float|null
  521.      */
  522.     public function getTotalProducts(): ?float
  523.     {
  524.         return $this->totalProducts;
  525.     }
  526.     /**
  527.      * @param float|null $totalProducts
  528.      *
  529.      * @return Cart
  530.      */
  531.     public function setTotalProducts(?float $totalProducts): self
  532.     {
  533.         $this->totalProducts $totalProducts;
  534.         return $this;
  535.     }
  536.     /**
  537.      * @return float|null
  538.      */
  539.     public function getTotalShipping(): ?float
  540.     {
  541.         return $this->totalShipping;
  542.     }
  543.     /**
  544.      * @param float|null $totalShipping
  545.      *
  546.      * @return Cart
  547.      */
  548.     public function setTotalShipping(?float $totalShipping): self
  549.     {
  550.         $this->totalShipping $totalShipping;
  551.         return $this;
  552.     }
  553.     /**
  554.      * @param CartProduct[] $cartProducts
  555.      */
  556.     public function addCartProducts(array $cartProducts): void
  557.     {
  558.         foreach ($cartProducts as $cartProduct) {
  559.             $this->cartProducts->add($cartProduct);
  560.         }
  561.     }
  562.     /**
  563.      * @return CartProduct[]|ArrayCollection
  564.      */
  565.     public function getCartProducts()
  566.     {
  567.         return $this->cartProducts;
  568.     }
  569.     public function getLogisticWeight(): ?float
  570.     {
  571.         return $this->logisticWeight;
  572.     }
  573.     public function setLogisticWeight(?float $logisticWeight): void
  574.     {
  575.         $this->logisticWeight $logisticWeight;
  576.     }
  577. }