<?php
namespace App\Entity\Gos;
use App\Repository\Gos\ProductBatchRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ProductBatchRepository::class)
*/
class ProductBatch
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=191, unique=true)
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity=ProductVariant::class)
* @ORM\JoinTable(name="product_batch_product_variant")
*/
private $productVariants;
public function __construct()
{
$this->productVariants = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function __toString(): string
{
return $this->name;
}
/**
* @return Collection|ProductVariant[]
*/
public function getProductVariants(): Collection
{
return $this->productVariants;
}
public function addProductVariant(ProductVariant $productVariant): self
{
if (!$this->productVariants->contains($productVariant)) {
$this->productVariants[] = $productVariant;
}
return $this;
}
public function removeProductVariant(ProductVariant $productVariant): self
{
if ($this->productVariants->contains($productVariant)) {
$this->productVariants->removeElement($productVariant);
}
return $this;
}
}