<?phpnamespace App\Entity\Gos;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass="App\Repository\Gos\EventProductVariantGroupItemRepository") * @ORM\HasLifecycleCallbacks */class EventProductVariantGroupItem{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity="EventProductVariantGroup", inversedBy="productVariantGroupItems") * @ORM\JoinColumn() */ private $productVariantGroup; /** * @ORM\ManyToOne(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="productVariantGroupItems") * @ORM\JoinColumn() */ private $productVariant; /** * @ORM\ManyToMany(targetEntity="App\Entity\Gos\CartParticipant", mappedBy="productVariantGroupItems") */ private $cartParticipants; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime", nullable=true) */ private $updatedAt; public function __construct() { $this->cartParticipants = 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; } public function getProductVariantGroup(): ?EventProductVariantGroup { return $this->productVariantGroup; } public function setProductVariantGroup(?EventProductVariantGroup $productVariantGroup): self { $this->productVariantGroup = $productVariantGroup; return $this; } public function getProductVariant(): ?ProductVariant { return $this->productVariant; } public function setProductVariant(?ProductVariant $productVariant): self { $this->productVariant = $productVariant; return $this; } /** * @return Collection|CartParticipant[] */ public function getCartParticipants(): Collection { return $this->cartParticipants; } public function addCartParticipant(CartParticipant $cartParticipant): self { if (!$this->cartParticipants->contains($cartParticipant)) { $this->cartParticipants[] = $cartParticipant; $cartParticipant->addProductVariantGroupItem($this); } return $this; } public function removeCartParticipant(CartParticipant $cartParticipant): self { if ($this->cartParticipants->contains($cartParticipant)) { $this->cartParticipants->removeElement($cartParticipant); $cartParticipant->removeProductVariantGroupItem($this); } return $this; }}