Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

156 lines
4.3KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Model\Reduction;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
  7. use Lc\CaracoleBundle\Doctrine\Extension\ReductionPropertyTrait;
  8. use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
  9. use Lc\CaracoleBundle\Doctrine\Extension\ReductionPropertyInterface;
  10. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  11. use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface;
  12. use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
  13. use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
  14. use Lc\CaracoleBundle\Model\Section\SectionInterface;
  15. use Lc\SovBundle\Doctrine\Extension\StatusInterface;
  16. use Lc\SovBundle\Doctrine\Extension\StatusTrait;
  17. use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
  18. /**
  19. * @ORM\MappedSuperclass()
  20. */
  21. abstract class ReductionCatalogModel extends AbstractLightEntity implements ReductionCatalogInterface,
  22. ReductionPropertyInterface,
  23. FilterSectionInterface, StatusInterface
  24. {
  25. use StatusTrait;
  26. use ReductionTrait;
  27. use ReductionPropertyTrait {
  28. ReductionPropertyTrait::__construct as private __reductionPropertyConstruct;
  29. }
  30. /**
  31. * @ORM\Column(type="string", length=255)
  32. */
  33. protected $title;
  34. /**
  35. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface")
  36. * @ORM\JoinColumn(nullable=false)
  37. */
  38. protected $section;
  39. /**
  40. * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
  41. */
  42. protected $productFamilies;
  43. /**
  44. * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
  45. */
  46. protected $productFamily;
  47. /**
  48. * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface")
  49. */
  50. protected $productCategories;
  51. public function __construct()
  52. {
  53. $this->__reductionPropertyConstruct();
  54. $this->productFamilies = new ArrayCollection();
  55. $this->productCategories = new ArrayCollection();
  56. }
  57. public function getTitle(): ?string
  58. {
  59. return $this->title;
  60. }
  61. public function setTitle(string $title): self
  62. {
  63. $this->title = $title;
  64. return $this;
  65. }
  66. public function getSection(): SectionInterface
  67. {
  68. return $this->section;
  69. }
  70. public function setSection(SectionInterface $section): self
  71. {
  72. $this->section = $section;
  73. return $this;
  74. }
  75. /**
  76. * @return Collection|ProductFamilyInterface[]
  77. */
  78. public function getProductFamilies(): Collection
  79. {
  80. return $this->productFamilies;
  81. }
  82. public function addProductFamily(ProductFamilyInterface $productFamily): self
  83. {
  84. if (!$this->productFamilies->contains($productFamily)) {
  85. $this->productFamilies[] = $productFamily;
  86. }
  87. return $this;
  88. }
  89. public function removeProductFamily(ProductFamilyInterface $productFamily): self
  90. {
  91. if ($this->productFamilies->contains($productFamily)) {
  92. $this->productFamilies->removeElement($productFamily);
  93. }
  94. return $this;
  95. }
  96. public function getProductFamily(): ?ProductFamilyInterface
  97. {
  98. return $this->productFamily;
  99. }
  100. public function setProductFamily(?ProductFamilyInterface $productFamily): self
  101. {
  102. $this->productFamily = $productFamily;
  103. return $this;
  104. }
  105. /**
  106. * @return Collection|ProductCategoryInterface[]
  107. */
  108. public function getProductCategories(): Collection
  109. {
  110. return $this->productCategories;
  111. }
  112. public function addProductCategory(ProductCategoryInterface $productCategory): self
  113. {
  114. if (!$this->productCategories->contains($productCategory)) {
  115. $this->productCategories[] = $productCategory;
  116. }
  117. return $this;
  118. }
  119. public function removeProductCategory(ProductCategoryInterface $productCategory): self
  120. {
  121. if ($this->productCategories->contains($productCategory)) {
  122. $this->productCategories->removeElement($productCategory);
  123. }
  124. return $this;
  125. }
  126. }