<?phpnamespace 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, nullable=true) */ private $name; /** * @ORM\OneToMany(targetEntity=Product::class, mappedBy="pack") */ private $products; /** * @ORM\Column(type="float") */ private $price; /** * @ORM\Column(type="string", length=255) */ private $image; /** * @ORM\Column(type="string", length=255) */ private $slug; /** * @ORM\OneToMany(targetEntity=CommandPack::class, mappedBy="pack") */ private $commandPacks; /** * @ORM\Column(type="string", length=255) */ private $category; /** * @ORM\Column(type="boolean") */ private $isActivate; /** * @ORM\OneToMany(targetEntity=ProductPercent::class, mappedBy="pack", cascade={"persist"}) */ private $productPercents; public function __construct() { $this->products = new ArrayCollection(); $this->commandPacks = new ArrayCollection(); $this->isActivate = true; $this->productPercents = 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; } /** * @return Collection|Product[] */ public function getProducts(): Collection { return $this->products; } public function addProduct(Product $product): self { if (!$this->products->contains($product)) { $this->products[] = $product; $product->setPack($this); } return $this; } public function removeProduct(Product $product): self { if ($this->products->contains($product)) { $this->products->removeElement($product); // set the owning side to null (unless already changed) if ($product->getPack() === $this) { $product->setPack(null); } } return $this; } public function getPrice(): ?float { return $this->price; } public function setPrice(float $price): self { $this->price = $price; return $this; } public function getImage() { return $this->image; } public function setImage($image): self { $this->image = $image; return $this; } public function getSlug(): ?string { return $this->slug; } public function setSlug(string $slug): self { $this->slug = $slug; return $this; } /** * @return Collection|CommandPack[] */ public function getCommandPacks(): Collection { return $this->commandPacks; } public function addCommandPack(CommandPack $commandPack): self { if (!$this->commandPacks->contains($commandPack)) { $this->commandPacks[] = $commandPack; $commandPack->setPack($this); } return $this; } public function removeCommandPack(CommandPack $commandPack): self { if ($this->commandPacks->contains($commandPack)) { $this->commandPacks->removeElement($commandPack); // set the owning side to null (unless already changed) if ($commandPack->getPack() === $this) { $commandPack->setPack(null); } } return $this; } public function getCategory(): ?string { return $this->category; } public function setCategory(string $category): self { $this->category = $category; return $this; } public function getIsActivate(): ?bool { return $this->isActivate; } public function setIsActivate(bool $isActivate): self { $this->isActivate = $isActivate; return $this; } /** * @return Collection|ProductPercent[] */ public function getProductPercents(): Collection { return $this->productPercents; } public function addProductPercent(ProductPercent $productPercent): self { if (!$this->productPercents->contains($productPercent)) { $this->productPercents[] = $productPercent; $productPercent->setPack($this); } return $this; } public function removeProductPercent(ProductPercent $productPercent): self { if ($this->productPercents->contains($productPercent)) { $this->productPercents->removeElement($productPercent); // set the owning side to null (unless already changed) if ($productPercent->getPack() === $this) { $productPercent->setPack(null); } } return $this; }}