src/Entity/Gos/ProductBatch.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Repository\Gos\ProductBatchRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ProductBatchRepository::class)
  9.  */
  10. class ProductBatch
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=191, unique=true)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\ManyToMany(targetEntity=ProductVariant::class)
  24.      * @ORM\JoinTable(name="product_batch_product_variant")
  25.      */
  26.     private $productVariants;
  27.     public function __construct()
  28.     {
  29.         $this->productVariants = new ArrayCollection();
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getName(): ?string
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function setName(string $name): self
  40.     {
  41.         $this->name $name;
  42.         return $this;
  43.     }
  44.     public function __toString(): string
  45.     {
  46.         return $this->name;
  47.     }
  48.     /**
  49.      * @return Collection|ProductVariant[]
  50.      */
  51.     public function getProductVariants(): Collection
  52.     {
  53.         return $this->productVariants;
  54.     }
  55.     public function addProductVariant(ProductVariant $productVariant): self
  56.     {
  57.         if (!$this->productVariants->contains($productVariant)) {
  58.             $this->productVariants[] = $productVariant;
  59.         }
  60.         return $this;
  61.     }
  62.     public function removeProductVariant(ProductVariant $productVariant): self
  63.     {
  64.         if ($this->productVariants->contains($productVariant)) {
  65.             $this->productVariants->removeElement($productVariant);
  66.         }
  67.         return $this;
  68.     }
  69. }