<?php namespace Lc\ShopBundle\Model; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Lc\ShopBundle\Context\ReductionInterface; /** * @ORM\MappedSuperclass() */ abstract class ReductionCatalog extends AbstractDocumentEntity implements ReductionInterface { use ReductionTrait; /** * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface") */ protected $productFamilies; /** * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface") */ protected $productCategories; /** * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\GroupUserInterface") */ protected $groupUsers; /** * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface") */ protected $users; public function __construct() { $this->productFamilies = new ArrayCollection(); $this->groupUsers = new ArrayCollection(); $this->productCategories = new ArrayCollection(); $this->users = new ArrayCollection(); } /** * @return Collection|ProductFamily[] */ public function getProductFamilies(): Collection { return $this->productFamilies; } public function addProductFamily(ProductFamily $productFamily): self { if (!$this->productFamilies->contains($productFamily)) { $this->productFamilies[] = $productFamily; } return $this; } public function removeProductFamily(ProductFamily $productFamily): self { if ($this->productFamilies->contains($productFamily)) { $this->productFamilies->removeElement($productFamily); } return $this; } /** * @return Collection|GroupUser[] */ public function getGroupUsers(): Collection { return $this->groupUsers; } public function addGroupUser(GroupUser $groupUser): self { if (!$this->groupUsers->contains($groupUser)) { $this->groupUsers[] = $groupUser; } return $this; } public function removeGroupUser(GroupUser $groupUser): self { if ($this->groupUsers->contains($groupUser)) { $this->groupUsers->removeElement($groupUser); } return $this; } /** * @return Collection|ProductCategory[] */ public function getProductCategories(): Collection { return $this->productCategories; } public function addProductCategory(ProductCategory $productCategory): self { if (!$this->productCategories->contains($productCategory)) { $this->productCategories[] = $productCategory; } return $this; } public function removeProductCategory(ProductCategory $productCategory): self { if ($this->productCategories->contains($productCategory)) { $this->productCategories->removeElement($productCategory); } return $this; } /** * @return Collection|User[] */ public function getUsers(): Collection { return $this->users; } public function addUser(User $user): self { if (!$this->users->contains($user)) { $this->users[] = $user; } return $this; } public function removeUser(User $user): self { if ($this->users->contains($user)) { $this->users->removeElement($user); } return $this; } }