src/Entity/Gos/PaymentMethod.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. /**
  8.  * PaymentMethod
  9.  *
  10.  * @ORM\Entity(repositoryClass="App\Repository\PaymentMethodRepository")
  11.  * @ORM\HasLifecycleCallbacks
  12.  */
  13. class PaymentMethod
  14. {
  15.     /**
  16.      * @var int
  17.      *
  18.      * @ORM\Column(name="id", type="integer")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @var string
  25.      *
  26.      * @ORM\Column(name="name", type="string", length=255)
  27.      */
  28.     private $name;
  29.     /**
  30.      * @Gedmo\Slug(fields={"name"})
  31.      * @ORM\Column(unique=true)
  32.      */
  33.     private $slug;
  34.     /**
  35.      * @ORM\Column(type="boolean", nullable=true)
  36.      */
  37.     private $isActive;
  38.     /**
  39.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductVariant", mappedBy="paymentMethod")
  40.      */
  41.     private $productVariant;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\ProductCart", mappedBy="paymentMethod")
  44.      */
  45.     private $productCart;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\OrderProductVariant", mappedBy="paymentMethod")
  48.      */
  49.     private $orderProductVariant;
  50.     /**
  51.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\OrderPart", mappedBy="paymentMethod")
  52.      */
  53.     private $orderPart;
  54.     /**
  55.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductMainType", mappedBy="allowedPayment")
  56.      */
  57.     private $productMainType;
  58.     /**
  59.      * @ORM\OneToMany(targetEntity="Cart", mappedBy="paymentMethod")
  60.      */
  61.     private $cart;
  62.     /**
  63.      * @ORM\Column(type="datetime")
  64.      */
  65.     private $createdAt;
  66.     /**
  67.      * @ORM\Column(type="datetime", nullable=true)
  68.      */
  69.     private $updatedAt;
  70.     /** @ORM\PrePersist() */
  71.     public function prePersist()
  72.     {
  73.         $this->createdAt = new \DateTime();
  74.     }
  75.     /** @ORM\PreUpdate() */
  76.     public function preUpdate()
  77.     {
  78.         $this->updatedAt = new \DateTime();
  79.     }
  80.     public function __toString()
  81.     {
  82.         return (string)$this->name;
  83.     }
  84.     /**
  85.      * Get id
  86.      *
  87.      * @return int
  88.      */
  89.     public function getId()
  90.     {
  91.         return $this->id;
  92.     }
  93.     /**
  94.      * Set name
  95.      *
  96.      * @param string $name
  97.      *
  98.      * @return PaymentMethod
  99.      */
  100.     public function setName($name)
  101.     {
  102.         $this->name $name;
  103.         return $this;
  104.     }
  105.     /**
  106.      * Get name
  107.      *
  108.      * @return string
  109.      */
  110.     public function getName()
  111.     {
  112.         return $this->name;
  113.     }
  114.     /**
  115.      * Set slug
  116.      *
  117.      * @param string $slug
  118.      *
  119.      * @return PaymentMethod
  120.      */
  121.     public function setSlug($slug)
  122.     {
  123.         $this->slug $slug;
  124.         return $this;
  125.     }
  126.     /**
  127.      * Get slug
  128.      *
  129.      * @return string
  130.      */
  131.     public function getSlug()
  132.     {
  133.         return $this->slug;
  134.     }
  135.     /**
  136.      * Set isActive
  137.      *
  138.      * @param boolean $isActive
  139.      *
  140.      * @return PaymentMethod
  141.      */
  142.     public function setIsActive($isActive)
  143.     {
  144.         $this->isActive $isActive;
  145.         return $this;
  146.     }
  147.     /**
  148.      * Get isActive
  149.      *
  150.      * @return boolean
  151.      */
  152.     public function getIsActive()
  153.     {
  154.         return $this->isActive;
  155.     }
  156.     /**
  157.      * Set createdAt
  158.      *
  159.      * @param \DateTime $createdAt
  160.      *
  161.      * @return PaymentMethod
  162.      */
  163.     public function setCreatedAt($createdAt)
  164.     {
  165.         $this->createdAt $createdAt;
  166.         return $this;
  167.     }
  168.     /**
  169.      * Get createdAt
  170.      *
  171.      * @return \DateTime
  172.      */
  173.     public function getCreatedAt()
  174.     {
  175.         return $this->createdAt;
  176.     }
  177.     /**
  178.      * Set updatedAt
  179.      *
  180.      * @param \DateTime $updatedAt
  181.      *
  182.      * @return PaymentMethod
  183.      */
  184.     public function setUpdatedAt($updatedAt)
  185.     {
  186.         $this->updatedAt $updatedAt;
  187.         return $this;
  188.     }
  189.     /**
  190.      * Get updatedAt
  191.      *
  192.      * @return \DateTime
  193.      */
  194.     public function getUpdatedAt()
  195.     {
  196.         return $this->updatedAt;
  197.     }
  198.     /**
  199.      * Constructor
  200.      */
  201.     public function __construct()
  202.     {
  203.         $this->productVariant = new \Doctrine\Common\Collections\ArrayCollection();
  204.         $this->productMainType = new \Doctrine\Common\Collections\ArrayCollection();
  205.         $this->productCart = new ArrayCollection();
  206.         $this->orderProductVariant = new ArrayCollection();
  207.         $this->orderPart = new ArrayCollection();
  208.         $this->cart = new ArrayCollection();
  209.     }
  210.     /**
  211.      * Add productVariant
  212.      *
  213.      * @param \App\Entity\Gos\ProductVariant $productVariant
  214.      *
  215.      * @return PaymentMethod
  216.      */
  217.     public function addProductVariant(\App\Entity\Gos\ProductVariant $productVariant)
  218.     {
  219.         $this->productVariant[] = $productVariant;
  220.         return $this;
  221.     }
  222.     /**
  223.      * Remove productVariant
  224.      *
  225.      * @param \App\Entity\Gos\ProductVariant $productVariant
  226.      */
  227.     public function removeProductVariant(\App\Entity\Gos\ProductVariant $productVariant)
  228.     {
  229.         $this->productVariant->removeElement($productVariant);
  230.     }
  231.     /**
  232.      * Get productVariant
  233.      *
  234.      * @return \Doctrine\Common\Collections\Collection
  235.      */
  236.     public function getProductVariant()
  237.     {
  238.         return $this->productVariant;
  239.     }
  240.     /**
  241.      * Add order
  242.      *
  243.      * @param \App\Entity\Gos\Orders $order
  244.      *
  245.      * @return PaymentMethod
  246.      */
  247.     public function addOrder(\App\Entity\Gos\Orders $order)
  248.     {
  249.         $this->orders[] = $order;
  250.         return $this;
  251.     }
  252.     /**
  253.      * Remove order
  254.      *
  255.      * @param \App\Entity\Gos\Orders $order
  256.      */
  257.     public function removeOrder(\App\Entity\Gos\Orders $order)
  258.     {
  259.         $this->orders->removeElement($order);
  260.     }
  261.     /**
  262.      * Get orders
  263.      *
  264.      * @return \Doctrine\Common\Collections\Collection
  265.      */
  266.     public function getOrders()
  267.     {
  268.         return $this->orders;
  269.     }
  270.     /**
  271.      * Add productCart
  272.      *
  273.      * @param \App\Entity\Gos\ProductCart $productCart
  274.      *
  275.      * @return PaymentMethod
  276.      */
  277.     public function addProductCart(\App\Entity\Gos\ProductCart $productCart)
  278.     {
  279.         $this->productCart[] = $productCart;
  280.         return $this;
  281.     }
  282.     /**
  283.      * Remove productCart
  284.      *
  285.      * @param \App\Entity\Gos\ProductCart $productCart
  286.      */
  287.     public function removeProductCart(\App\Entity\Gos\ProductCart $productCart)
  288.     {
  289.         $this->productCart->removeElement($productCart);
  290.     }
  291.     /**
  292.      * Get productCart
  293.      *
  294.      * @return \Doctrine\Common\Collections\Collection
  295.      */
  296.     public function getProductCart()
  297.     {
  298.         return $this->productCart;
  299.     }
  300.     /**
  301.      * Add orderProductVariant
  302.      *
  303.      * @param \App\Entity\Gos\OrderProductVariant $orderProductVariant
  304.      *
  305.      * @return PaymentMethod
  306.      */
  307.     public function addOrderProductVariant(\App\Entity\Gos\OrderProductVariant $orderProductVariant)
  308.     {
  309.         $this->orderProductVariant[] = $orderProductVariant;
  310.         return $this;
  311.     }
  312.     /**
  313.      * Remove orderProductVariant
  314.      *
  315.      * @param \App\Entity\Gos\OrderProductVariant $orderProductVariant
  316.      */
  317.     public function removeOrderProductVariant(\App\Entity\Gos\OrderProductVariant $orderProductVariant)
  318.     {
  319.         $this->orderProductVariant->removeElement($orderProductVariant);
  320.     }
  321.     /**
  322.      * Get orderProductVariant
  323.      *
  324.      * @return \Doctrine\Common\Collections\Collection
  325.      */
  326.     public function getOrderProductVariant()
  327.     {
  328.         return $this->orderProductVariant;
  329.     }
  330.     /**
  331.      * Add productMainType
  332.      *
  333.      * @param \App\Entity\Gos\ProductMainType $productMainType
  334.      *
  335.      * @return PaymentMethod
  336.      */
  337.     public function addProductMainType(\App\Entity\Gos\ProductMainType $productMainType)
  338.     {
  339.         $this->productMainType[] = $productMainType;
  340.         return $this;
  341.     }
  342.     /**
  343.      * Remove productMainType
  344.      *
  345.      * @param \App\Entity\Gos\ProductMainType $productMainType
  346.      */
  347.     public function removeProductMainType(\App\Entity\Gos\ProductMainType $productMainType)
  348.     {
  349.         $this->productMainType->removeElement($productMainType);
  350.     }
  351.     /**
  352.      * Get productMainType
  353.      *
  354.      * @return \Doctrine\Common\Collections\Collection
  355.      */
  356.     public function getProductMainType()
  357.     {
  358.         return $this->productMainType;
  359.     }
  360.     /**
  361.      * Add orderPart
  362.      *
  363.      * @param \App\Entity\Gos\OrderPart $orderPart
  364.      *
  365.      * @return PaymentMethod
  366.      */
  367.     public function addOrderPart(\App\Entity\Gos\OrderPart $orderPart)
  368.     {
  369.         $this->orderPart[] = $orderPart;
  370.         return $this;
  371.     }
  372.     /**
  373.      * Remove orderPart
  374.      *
  375.      * @param \App\Entity\Gos\OrderPart $orderPart
  376.      */
  377.     public function removeOrderPart(\App\Entity\Gos\OrderPart $orderPart)
  378.     {
  379.         $this->orderPart->removeElement($orderPart);
  380.     }
  381.     /**
  382.      * Get orderPart
  383.      *
  384.      * @return \Doctrine\Common\Collections\Collection
  385.      */
  386.     public function getOrderPart()
  387.     {
  388.         return $this->orderPart;
  389.     }
  390.     /**
  391.      * @return Collection|Cart[]
  392.      */
  393.     public function getCart(): Collection
  394.     {
  395.         return $this->cart;
  396.     }
  397.     public function addCart(Cart $cart): self
  398.     {
  399.         if (!$this->cart->contains($cart)) {
  400.             $this->cart[] = $cart;
  401.             $cart->setPaymentMethod($this);
  402.         }
  403.         return $this;
  404.     }
  405.     public function removeCart(Cart $cart): self
  406.     {
  407.         if ($this->cart->contains($cart)) {
  408.             $this->cart->removeElement($cart);
  409.             // set the owning side to null (unless already changed)
  410.             if ($cart->getPaymentMethod() === $this) {
  411.                 $cart->setPaymentMethod(null);
  412.             }
  413.         }
  414.         return $this;
  415.     }
  416. }