src/Flexy/ShopBundle/Entity/Product/ProductPack.php line 11
<?php
namespace App\Flexy\ShopBundle\Entity\Product;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\Flexy\ShopBundle\Entity\Product\ProductPackRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ProductPackRepository::class)]
#[ApiResource]
class ProductPack
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne]
private ?Product $product = null;
#[ORM\Column(nullable: true)]
private ?int $quantity = null;
#[ORM\ManyToOne(inversedBy: 'childrenPackProducts')]
#[ORM\JoinColumn(nullable: false)]
private ?Product $parentProduct = null;
public function __toString()
{
return $this->product." x ".$this->quantity;
}
public function getId(): ?int
{
return $this->id;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): self
{
$this->product = $product;
return $this;
}
public function getQuantity(): ?int
{
return $this->quantity;
}
public function setQuantity(?int $quantity): self
{
$this->quantity = $quantity;
return $this;
}
public function getParentProduct(): ?Product
{
return $this->parentProduct;
}
public function setParentProduct(?Product $parentProduct): self
{
$this->parentProduct = $parentProduct;
return $this;
}
}