<?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;
/**
* @ORM\Entity(repositoryClass="App\Repository\Gos\EventProductVariantGroupRepository")
* @ORM\HasLifecycleCallbacks
*/
class EventProductVariantGroup
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=191)
*/
private $name;
/**
* @Gedmo\Slug(fields={"name"})
* @ORM\Column(unique=true, length=191)
*/
private $slug;
/**
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @ORM\OneToMany(targetEntity="EventProductVariantGroupItem", mappedBy="productVariantGroup", cascade={"persist"}, orphanRemoval=true)
*/
private $productVariantGroupItems;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="productVariantGroups")
* @ORM\JoinColumn()
*/
private $productVariant;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
public function __construct()
{
$this->productVariantGroupItems = new ArrayCollection();
}
/** @ORM\PrePersist() */
public function prePersist()
{
$this->createdAt = new \DateTime();
}
/** @ORM\PreUpdate() */
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
public function __toString()
{
return (string) $this->id;
}
//------------------------------ setters & getters
public function getId(): ?int
{
return $this->id;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return Collection|EventProductVariantGroupItem[]
*/
public function getProductVariantGroupItems(): Collection
{
return $this->productVariantGroupItems;
}
public function addProductVariantGroupItem(EventProductVariantGroupItem $productVariantGroupItem): self
{
if (!$this->productVariantGroupItems->contains($productVariantGroupItem)) {
$this->productVariantGroupItems[] = $productVariantGroupItem;
$productVariantGroupItem->setProductVariantGroup($this);
}
return $this;
}
public function removeProductVariantGroupItem(EventProductVariantGroupItem $productVariantGroupItem): self
{
if ($this->productVariantGroupItems->contains($productVariantGroupItem)) {
$this->productVariantGroupItems->removeElement($productVariantGroupItem);
// set the owning side to null (unless already changed)
if ($productVariantGroupItem->getProductVariantGroup() === $this) {
$productVariantGroupItem->setProductVariantGroup(null);
}
}
return $this;
}
public function getProductVariant(): ?ProductVariant
{
return $this->productVariant;
}
public function setProductVariant(?ProductVariant $productVariant): self
{
$this->productVariant = $productVariant;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
}