src/Entity/Gos/EventProductVariantGroup.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\EventProductVariantGroupRepository")
  9.  * @ORM\HasLifecycleCallbacks
  10.  */
  11. class EventProductVariantGroup
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @var string
  21.      *
  22.      * @ORM\Column(name="name", type="string", length=191)
  23.      */
  24.     private $name;
  25.     /**
  26.      * @Gedmo\Slug(fields={"name"})
  27.      * @ORM\Column(unique=true, length=191)
  28.      */
  29.     private $slug;
  30.     /**
  31.      * @ORM\Column(name="description", type="text", nullable=true)
  32.      */
  33.     private $description;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity="EventProductVariantGroupItem", mappedBy="productVariantGroup", cascade={"persist"}, orphanRemoval=true)
  36.      */
  37.     private $productVariantGroupItems;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="productVariantGroups")
  40.      * @ORM\JoinColumn()
  41.      */
  42.     private $productVariant;
  43.     /**
  44.      * @ORM\Column(type="datetime")
  45.      */
  46.     private $createdAt;
  47.     /**
  48.      * @ORM\Column(type="datetime", nullable=true)
  49.      */
  50.     private $updatedAt;
  51.     public function __construct()
  52.     {
  53.         $this->productVariantGroupItems = new ArrayCollection();
  54.     }
  55.     /** @ORM\PrePersist() */
  56.     public function prePersist()
  57.     {
  58.         $this->createdAt = new \DateTime();
  59.     }
  60.     /** @ORM\PreUpdate() */
  61.     public function preUpdate()
  62.     {
  63.         $this->updatedAt = new \DateTime();
  64.     }
  65.     public function __toString()
  66.     {
  67.         return (string) $this->id;
  68.     }
  69.     //------------------------------ setters & getters
  70.     public function getId(): ?int
  71.     {
  72.         return $this->id;
  73.     }
  74.     public function getCreatedAt(): ?\DateTimeInterface
  75.     {
  76.         return $this->createdAt;
  77.     }
  78.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  79.     {
  80.         $this->createdAt $createdAt;
  81.         return $this;
  82.     }
  83.     public function getUpdatedAt(): ?\DateTimeInterface
  84.     {
  85.         return $this->updatedAt;
  86.     }
  87.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  88.     {
  89.         $this->updatedAt $updatedAt;
  90.         return $this;
  91.     }
  92.     /**
  93.      * @return Collection|EventProductVariantGroupItem[]
  94.      */
  95.     public function getProductVariantGroupItems(): Collection
  96.     {
  97.         return $this->productVariantGroupItems;
  98.     }
  99.     public function addProductVariantGroupItem(EventProductVariantGroupItem $productVariantGroupItem): self
  100.     {
  101.         if (!$this->productVariantGroupItems->contains($productVariantGroupItem)) {
  102.             $this->productVariantGroupItems[] = $productVariantGroupItem;
  103.             $productVariantGroupItem->setProductVariantGroup($this);
  104.         }
  105.         return $this;
  106.     }
  107.     public function removeProductVariantGroupItem(EventProductVariantGroupItem $productVariantGroupItem): self
  108.     {
  109.         if ($this->productVariantGroupItems->contains($productVariantGroupItem)) {
  110.             $this->productVariantGroupItems->removeElement($productVariantGroupItem);
  111.             // set the owning side to null (unless already changed)
  112.             if ($productVariantGroupItem->getProductVariantGroup() === $this) {
  113.                 $productVariantGroupItem->setProductVariantGroup(null);
  114.             }
  115.         }
  116.         return $this;
  117.     }
  118.     public function getProductVariant(): ?ProductVariant
  119.     {
  120.         return $this->productVariant;
  121.     }
  122.     public function setProductVariant(?ProductVariant $productVariant): self
  123.     {
  124.         $this->productVariant $productVariant;
  125.         return $this;
  126.     }
  127.     public function getName(): ?string
  128.     {
  129.         return $this->name;
  130.     }
  131.     public function setName(string $name): self
  132.     {
  133.         $this->name $name;
  134.         return $this;
  135.     }
  136.     public function getSlug(): ?string
  137.     {
  138.         return $this->slug;
  139.     }
  140.     public function setSlug(string $slug): self
  141.     {
  142.         $this->slug $slug;
  143.         return $this;
  144.     }
  145.     public function getDescription(): ?string
  146.     {
  147.         return $this->description;
  148.     }
  149.     public function setDescription(?string $description): self
  150.     {
  151.         $this->description $description;
  152.         return $this;
  153.     }
  154. }