src/Entity/Gos/EventProductVariantGroupItem.php line 13

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. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\Gos\EventProductVariantGroupItemRepository")
  8.  * @ORM\HasLifecycleCallbacks
  9.  */
  10. class EventProductVariantGroupItem
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity="EventProductVariantGroup", inversedBy="productVariantGroupItems")
  20.      * @ORM\JoinColumn()
  21.      */
  22.     private $productVariantGroup;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="productVariantGroupItems")
  25.      * @ORM\JoinColumn()
  26.      */
  27.     private $productVariant;
  28.     /**
  29.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\CartParticipant", mappedBy="productVariantGroupItems")
  30.      */
  31.     private $cartParticipants;
  32.     /**
  33.      * @ORM\Column(type="datetime")
  34.      */
  35.     private $createdAt;
  36.     /**
  37.      * @ORM\Column(type="datetime", nullable=true)
  38.      */
  39.     private $updatedAt;
  40.     public function __construct()
  41.     {
  42.         $this->cartParticipants = new ArrayCollection();
  43.     }
  44.     /** @ORM\PrePersist() */
  45.     public function prePersist()
  46.     {
  47.         $this->createdAt = new \DateTime();
  48.     }
  49.     /** @ORM\PreUpdate() */
  50.     public function preUpdate()
  51.     {
  52.         $this->updatedAt = new \DateTime();
  53.     }
  54.     public function __toString()
  55.     {
  56.         return (string) $this->id;
  57.     }
  58.     //------------------------------ setters & getters
  59.     public function getId(): ?int
  60.     {
  61.         return $this->id;
  62.     }
  63.     public function getCreatedAt(): ?\DateTimeInterface
  64.     {
  65.         return $this->createdAt;
  66.     }
  67.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  68.     {
  69.         $this->createdAt $createdAt;
  70.         return $this;
  71.     }
  72.     public function getUpdatedAt(): ?\DateTimeInterface
  73.     {
  74.         return $this->updatedAt;
  75.     }
  76.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  77.     {
  78.         $this->updatedAt $updatedAt;
  79.         return $this;
  80.     }
  81.     public function getProductVariantGroup(): ?EventProductVariantGroup
  82.     {
  83.         return $this->productVariantGroup;
  84.     }
  85.     public function setProductVariantGroup(?EventProductVariantGroup $productVariantGroup): self
  86.     {
  87.         $this->productVariantGroup $productVariantGroup;
  88.         return $this;
  89.     }
  90.     public function getProductVariant(): ?ProductVariant
  91.     {
  92.         return $this->productVariant;
  93.     }
  94.     public function setProductVariant(?ProductVariant $productVariant): self
  95.     {
  96.         $this->productVariant $productVariant;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection|CartParticipant[]
  101.      */
  102.     public function getCartParticipants(): Collection
  103.     {
  104.         return $this->cartParticipants;
  105.     }
  106.     public function addCartParticipant(CartParticipant $cartParticipant): self
  107.     {
  108.         if (!$this->cartParticipants->contains($cartParticipant)) {
  109.             $this->cartParticipants[] = $cartParticipant;
  110.             $cartParticipant->addProductVariantGroupItem($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeCartParticipant(CartParticipant $cartParticipant): self
  115.     {
  116.         if ($this->cartParticipants->contains($cartParticipant)) {
  117.             $this->cartParticipants->removeElement($cartParticipant);
  118.             $cartParticipant->removeProductVariantGroupItem($this);
  119.         }
  120.         return $this;
  121.     }
  122. }