<?php
namespace App\Entity;
use App\Repository\PackRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=PackRepository::class)
*/
class Pack
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $label;
/**
* @ORM\Column(type="integer")
*/
private $price;
/**
* @ORM\Column(type="datetime")
*/
private $creation_date;
/**
* @ORM\ManyToMany(targetEntity="Product")
* @ORM\JoinTable(name="pack_products",
* joinColumns={@ORM\JoinColumn(name="pack_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="id")}
* )
*/
private $products;
/**
* @ORM\Column(type="integer")
*/
private $quantity;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $barcode;
/**
* @ORM\OneToMany(targetEntity=SalePacks::class, mappedBy="pack")
*/
private $salePacks;
/**
* @ORM\Column(type="string", length=255)
*/
private $target;
/**
* @ORM\Column(type="boolean")
*/
private $isSynch;
/**
* @ORM\Column(type="boolean")
*/
private $deleted = 0;
public function __construct()
{
$this->products = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getPrice(): ?int
{
return $this->price;
}
public function setPrice(int $price): self
{
$this->price = $price;
return $this;
}
public function getCreationDate(): ?\DateTimeInterface
{
return $this->creation_date;
}
public function setCreationDate(\DateTimeInterface $creation_date): self
{
$this->creation_date = $creation_date;
return $this;
}
/**
* @return Collection<int, PackProducts>
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(PackProducts $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->setPack($this);
}
return $this;
}
public function removeProduct(PackProducts $product): self
{
if ($this->products->removeElement($product)) {
// set the owning side to null (unless already changed)
if ($product->getPack() === $this) {
$product->setPack(null);
}
}
return $this;
}
public function getQuantity(): ?int
{
return $this->quantity;
}
public function setQuantity(int $quantity): self
{
$this->quantity = $quantity;
return $this;
}
public function getBarcode(): ?string
{
return $this->barcode;
}
public function setBarcode(?string $barcode): self
{
$this->barcode = $barcode;
return $this;
}
/**
* @return Collection<int, SalePacks>
*/
public function getSalePacks(): Collection
{
return $this->salePacks;
}
public function addSalePacks(SalePacks $saleItem): self
{
if (!$this->salePacks->contains($saleItem)) {
$this->salePacks[] = $saleItem;
$saleItem->setPack($this);
}
return $this;
}
public function removeSalePacks(SalePacks $saleItem): self
{
if ($this->salePacks->removeElement($saleItem)) {
// set the owning side to null (unless already changed)
if ($saleItem->getProduct() === $this) {
$saleItem->setProduct(null);
}
}
return $this;
}
/**
* @return mixed
*/
public function getTarget()
{
return $this->target;
}
/**
* @param mixed $target
*/
public function setTarget($target): void
{
$this->target = $target;
}
/**
* @return mixed
*/
public function getisSynch()
{
return $this->isSynch;
}
/**
* @param mixed $isSynch
*/
public function setisSynch($isSynch): void
{
$this->isSynch = $isSynch;
}
/**
* @return mixed
*/
public function getDeleted()
{
return $this->deleted;
}
/**
* @param mixed $deleted
*/
public function setDeleted($deleted): void
{
$this->deleted = $deleted;
}
}