src/Entity/Gos/PaymentType.php line 14

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.  * @ORM\Entity(repositoryClass="App\Repository\Gos\PaymentTypeRepository")
  9.  * @ORM\HasLifecycleCallbacks()
  10.  */
  11. class PaymentType
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="boolean", nullable=true)
  21.      */
  22.     private $isActive;
  23.     /**
  24.      * @ORM\Column(type="string", length=100)
  25.      */
  26.     private $name;
  27.     /**
  28.      * @Gedmo\Slug(fields={"name"})
  29.      * @ORM\Column(type="string", unique=true, length=100)
  30.      */
  31.     private $slug;
  32.     /**
  33.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\ProductVariant", mappedBy="paymentType")
  34.      */
  35.     private $productVariant;
  36.     /**
  37.      * @ORM\Column(type="datetime")
  38.      */
  39.     private $createdAt;
  40.     /**
  41.      * @ORM\Column(type="datetime", nullable=true)
  42.      */
  43.     private $updatedAt;
  44.     public function __construct()
  45.     {
  46.         $this->productVariant = new ArrayCollection();
  47.     }
  48.     /** @ORM\PrePersist() */
  49.     public function prePersist()
  50.     {
  51.         $this->createdAt = new \DateTime();
  52.     }
  53.     /** @ORM\PreUpdate() */
  54.     public function preUpdate()
  55.     {
  56.         $this->updatedAt = new \DateTime();
  57.     }
  58.     public function __toString()
  59.     {
  60.         return (string)$this->name;
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getIsActive(): ?bool
  67.     {
  68.         return $this->isActive;
  69.     }
  70.     public function setIsActive(?bool $isActive): self
  71.     {
  72.         $this->isActive $isActive;
  73.         return $this;
  74.     }
  75.     public function getName(): ?string
  76.     {
  77.         return $this->name;
  78.     }
  79.     public function setName(string $name): self
  80.     {
  81.         $this->name $name;
  82.         return $this;
  83.     }
  84.     public function getSlug(): ?string
  85.     {
  86.         return $this->slug;
  87.     }
  88.     public function setSlug(string $slug): self
  89.     {
  90.         $this->slug $slug;
  91.         return $this;
  92.     }
  93.     public function getCreatedAt(): ?\DateTimeInterface
  94.     {
  95.         return $this->createdAt;
  96.     }
  97.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  98.     {
  99.         $this->createdAt $createdAt;
  100.         return $this;
  101.     }
  102.     public function getUpdatedAt(): ?\DateTimeInterface
  103.     {
  104.         return $this->updatedAt;
  105.     }
  106.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  107.     {
  108.         $this->updatedAt $updatedAt;
  109.         return $this;
  110.     }
  111.     /**
  112.      * @return Collection|ProductVariant[]
  113.      */
  114.     public function getProductVariant(): Collection
  115.     {
  116.         return $this->productVariant;
  117.     }
  118.     public function addProductVariant(ProductVariant $productVariant): self
  119.     {
  120.         if (!$this->productVariant->contains($productVariant)) {
  121.             $this->productVariant[] = $productVariant;
  122.             $productVariant->setPaymentType($this);
  123.         }
  124.         return $this;
  125.     }
  126.     public function removeProductVariant(ProductVariant $productVariant): self
  127.     {
  128.         if ($this->productVariant->contains($productVariant)) {
  129.             $this->productVariant->removeElement($productVariant);
  130.             // set the owning side to null (unless already changed)
  131.             if ($productVariant->getPaymentType() === $this) {
  132.                 $productVariant->setPaymentType(null);
  133.             }
  134.         }
  135.         return $this;
  136.     }
  137. }