您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ReductionCatalogModel.php 4.2KB

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