<?php
namespace App\Entity\Gos;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* PaymentMethod
*
* @ORM\Entity(repositoryClass="App\Repository\PaymentMethodRepository")
* @ORM\HasLifecycleCallbacks
*/
class PaymentMethod
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @Gedmo\Slug(fields={"name"})
* @ORM\Column(unique=true)
*/
private $slug;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isActive;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductVariant", mappedBy="paymentMethod")
*/
private $productVariant;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Gos\ProductCart", mappedBy="paymentMethod")
*/
private $productCart;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Gos\OrderProductVariant", mappedBy="paymentMethod")
*/
private $orderProductVariant;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Gos\OrderPart", mappedBy="paymentMethod")
*/
private $orderPart;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductMainType", mappedBy="allowedPayment")
*/
private $productMainType;
/**
* @ORM\OneToMany(targetEntity="Cart", mappedBy="paymentMethod")
*/
private $cart;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/** @ORM\PrePersist() */
public function prePersist()
{
$this->createdAt = new \DateTime();
}
/** @ORM\PreUpdate() */
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
public function __toString()
{
return (string)$this->name;
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return PaymentMethod
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set slug
*
* @param string $slug
*
* @return PaymentMethod
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set isActive
*
* @param boolean $isActive
*
* @return PaymentMethod
*/
public function setIsActive($isActive)
{
$this->isActive = $isActive;
return $this;
}
/**
* Get isActive
*
* @return boolean
*/
public function getIsActive()
{
return $this->isActive;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return PaymentMethod
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* @param \DateTime $updatedAt
*
* @return PaymentMethod
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Constructor
*/
public function __construct()
{
$this->productVariant = new \Doctrine\Common\Collections\ArrayCollection();
$this->productMainType = new \Doctrine\Common\Collections\ArrayCollection();
$this->productCart = new ArrayCollection();
$this->orderProductVariant = new ArrayCollection();
$this->orderPart = new ArrayCollection();
$this->cart = new ArrayCollection();
}
/**
* Add productVariant
*
* @param \App\Entity\Gos\ProductVariant $productVariant
*
* @return PaymentMethod
*/
public function addProductVariant(\App\Entity\Gos\ProductVariant $productVariant)
{
$this->productVariant[] = $productVariant;
return $this;
}
/**
* Remove productVariant
*
* @param \App\Entity\Gos\ProductVariant $productVariant
*/
public function removeProductVariant(\App\Entity\Gos\ProductVariant $productVariant)
{
$this->productVariant->removeElement($productVariant);
}
/**
* Get productVariant
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductVariant()
{
return $this->productVariant;
}
/**
* Add order
*
* @param \App\Entity\Gos\Orders $order
*
* @return PaymentMethod
*/
public function addOrder(\App\Entity\Gos\Orders $order)
{
$this->orders[] = $order;
return $this;
}
/**
* Remove order
*
* @param \App\Entity\Gos\Orders $order
*/
public function removeOrder(\App\Entity\Gos\Orders $order)
{
$this->orders->removeElement($order);
}
/**
* Get orders
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getOrders()
{
return $this->orders;
}
/**
* Add productCart
*
* @param \App\Entity\Gos\ProductCart $productCart
*
* @return PaymentMethod
*/
public function addProductCart(\App\Entity\Gos\ProductCart $productCart)
{
$this->productCart[] = $productCart;
return $this;
}
/**
* Remove productCart
*
* @param \App\Entity\Gos\ProductCart $productCart
*/
public function removeProductCart(\App\Entity\Gos\ProductCart $productCart)
{
$this->productCart->removeElement($productCart);
}
/**
* Get productCart
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductCart()
{
return $this->productCart;
}
/**
* Add orderProductVariant
*
* @param \App\Entity\Gos\OrderProductVariant $orderProductVariant
*
* @return PaymentMethod
*/
public function addOrderProductVariant(\App\Entity\Gos\OrderProductVariant $orderProductVariant)
{
$this->orderProductVariant[] = $orderProductVariant;
return $this;
}
/**
* Remove orderProductVariant
*
* @param \App\Entity\Gos\OrderProductVariant $orderProductVariant
*/
public function removeOrderProductVariant(\App\Entity\Gos\OrderProductVariant $orderProductVariant)
{
$this->orderProductVariant->removeElement($orderProductVariant);
}
/**
* Get orderProductVariant
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getOrderProductVariant()
{
return $this->orderProductVariant;
}
/**
* Add productMainType
*
* @param \App\Entity\Gos\ProductMainType $productMainType
*
* @return PaymentMethod
*/
public function addProductMainType(\App\Entity\Gos\ProductMainType $productMainType)
{
$this->productMainType[] = $productMainType;
return $this;
}
/**
* Remove productMainType
*
* @param \App\Entity\Gos\ProductMainType $productMainType
*/
public function removeProductMainType(\App\Entity\Gos\ProductMainType $productMainType)
{
$this->productMainType->removeElement($productMainType);
}
/**
* Get productMainType
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductMainType()
{
return $this->productMainType;
}
/**
* Add orderPart
*
* @param \App\Entity\Gos\OrderPart $orderPart
*
* @return PaymentMethod
*/
public function addOrderPart(\App\Entity\Gos\OrderPart $orderPart)
{
$this->orderPart[] = $orderPart;
return $this;
}
/**
* Remove orderPart
*
* @param \App\Entity\Gos\OrderPart $orderPart
*/
public function removeOrderPart(\App\Entity\Gos\OrderPart $orderPart)
{
$this->orderPart->removeElement($orderPart);
}
/**
* Get orderPart
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getOrderPart()
{
return $this->orderPart;
}
/**
* @return Collection|Cart[]
*/
public function getCart(): Collection
{
return $this->cart;
}
public function addCart(Cart $cart): self
{
if (!$this->cart->contains($cart)) {
$this->cart[] = $cart;
$cart->setPaymentMethod($this);
}
return $this;
}
public function removeCart(Cart $cart): self
{
if ($this->cart->contains($cart)) {
$this->cart->removeElement($cart);
// set the owning side to null (unless already changed)
if ($cart->getPaymentMethod() === $this) {
$cart->setPaymentMethod(null);
}
}
return $this;
}
}