Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

205 lines
5.5KB

  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Lc\ShopBundle\Context\FilterMerchantInterface;
  7. use Lc\ShopBundle\Context\ReductionCatalogInterface;
  8. use Lc\ShopBundle\Context\ReductionInterface;
  9. use phpDocumentor\Reflection\Types\Integer;
  10. /**
  11. * @ORM\MappedSuperclass()
  12. */
  13. abstract class ReductionCatalog extends AbstractDocumentEntity implements ReductionCatalogInterface, FilterMerchantInterface
  14. {
  15. use ReductionTrait;
  16. use ReductionPropertyTrait ;
  17. /**
  18. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="productFamilies")
  19. * @ORM\JoinColumn(nullable=false)
  20. */
  21. protected $merchant;
  22. /**
  23. * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface")
  24. */
  25. protected $productFamilies;
  26. /**
  27. * @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface")
  28. */
  29. protected $productFamily;
  30. /**
  31. * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface")
  32. */
  33. protected $productCategories;
  34. /**
  35. * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\GroupUserInterface")
  36. */
  37. protected $groupUsers;
  38. /**
  39. * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface")
  40. */
  41. protected $users;
  42. public function __construct()
  43. {
  44. $this->productFamilies = new ArrayCollection();
  45. $this->groupUsers = new ArrayCollection();
  46. $this->productCategories = new ArrayCollection();
  47. $this->users = new ArrayCollection();
  48. }
  49. public function getMerchant(): ?Merchant
  50. {
  51. return $this->merchant;
  52. }
  53. public function setMerchant(?Merchant $merchant): self
  54. {
  55. $this->merchant = $merchant;
  56. return $this;
  57. }
  58. /**
  59. * @return Collection|ProductFamily[]
  60. */
  61. public function getProductFamilies(): Collection
  62. {
  63. return $this->productFamilies;
  64. }
  65. public function addProductFamily(ProductFamily $productFamily): self
  66. {
  67. if (!$this->productFamilies->contains($productFamily)) {
  68. $this->productFamilies[] = $productFamily;
  69. }
  70. return $this;
  71. }
  72. public function removeProductFamily(ProductFamily $productFamily): self
  73. {
  74. if ($this->productFamilies->contains($productFamily)) {
  75. $this->productFamilies->removeElement($productFamily);
  76. }
  77. return $this;
  78. }
  79. public function getProductFamily(): ?ProductFamily
  80. {
  81. return $this->productFamily;
  82. }
  83. public function setProductFamily(?ProductFamily $productFamily): self
  84. {
  85. $this->productFamily = $productFamily;
  86. return $this;
  87. }
  88. /**
  89. * @return Collection|GroupUser[]
  90. */
  91. public function getGroupUsers(): Collection
  92. {
  93. return $this->groupUsers;
  94. }
  95. public function addGroupUser(GroupUser $groupUser): self
  96. {
  97. if (!$this->groupUsers->contains($groupUser)) {
  98. $this->groupUsers[] = $groupUser;
  99. }
  100. return $this;
  101. }
  102. public function removeGroupUser(GroupUser $groupUser): self
  103. {
  104. if ($this->groupUsers->contains($groupUser)) {
  105. $this->groupUsers->removeElement($groupUser);
  106. }
  107. return $this;
  108. }
  109. /**
  110. * @return Collection|ProductCategory[]
  111. */
  112. public function getProductCategories(): Collection
  113. {
  114. return $this->productCategories;
  115. }
  116. public function addProductCategory(ProductCategory $productCategory): self
  117. {
  118. if (!$this->productCategories->contains($productCategory)) {
  119. $this->productCategories[] = $productCategory;
  120. }
  121. return $this;
  122. }
  123. public function removeProductCategory(ProductCategory $productCategory): self
  124. {
  125. if ($this->productCategories->contains($productCategory)) {
  126. $this->productCategories->removeElement($productCategory);
  127. }
  128. return $this;
  129. }
  130. /**
  131. * @return Collection|User[]
  132. */
  133. public function getUsers(): Collection
  134. {
  135. return $this->users;
  136. }
  137. public function addUser(User $user): self
  138. {
  139. if (!$this->users->contains($user)) {
  140. $this->users[] = $user;
  141. }
  142. return $this;
  143. }
  144. public function removeUser(User $user): self
  145. {
  146. if ($this->users->contains($user)) {
  147. $this->users->removeElement($user);
  148. }
  149. return $this;
  150. }
  151. /*public function getFromQuantity(): ?int
  152. {
  153. return $this->fromQuantity;
  154. }
  155. public function setFromQuantity(int $fromQuantity): self
  156. {
  157. $this->fromQuantity = $fromQuantity;
  158. return $this;
  159. }*/
  160. }