選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ReductionCatalogModel.php 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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\FilterMerchantInterface;
  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\SovBundle\Doctrine\Extension\StatusInterface;
  14. use Lc\SovBundle\Doctrine\Extension\StatusTrait;
  15. use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
  16. /**
  17. * @ORM\MappedSuperclass()
  18. */
  19. abstract class ReductionCatalogModel extends AbstractLightEntity implements ReductionCatalogInterface,
  20. ReductionPropertyInterface,
  21. FilterMerchantInterface,
  22. 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\Merchant\MerchantInterface")
  35. * @ORM\JoinColumn(nullable=false)
  36. */
  37. protected $merchant;
  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. /**
  51. * @ORM\Column(type="boolean", nullable=false)
  52. */
  53. protected $isDisplayed;
  54. public function __construct()
  55. {
  56. $this->__reductionPropertyConstruct();
  57. $this->productFamilies = new ArrayCollection();
  58. $this->productCategories = new ArrayCollection();
  59. }
  60. public function getTitle(): ?string
  61. {
  62. return $this->title;
  63. }
  64. public function setTitle(string $title): self
  65. {
  66. $this->title = $title;
  67. return $this;
  68. }
  69. public function getMerchant(): MerchantInterface
  70. {
  71. return $this->merchant;
  72. }
  73. public function setMerchant(MerchantInterface $merchant): self
  74. {
  75. $this->merchant = $merchant;
  76. return $this;
  77. }
  78. /**
  79. * @return Collection|ProductFamilyInterface[]
  80. */
  81. public function getProductFamilies(): Collection
  82. {
  83. return $this->productFamilies;
  84. }
  85. public function addProductFamily(ProductFamilyInterface $productFamily): self
  86. {
  87. if (!$this->productFamilies->contains($productFamily)) {
  88. $this->productFamilies[] = $productFamily;
  89. }
  90. return $this;
  91. }
  92. public function removeProductFamily(ProductFamilyInterface $productFamily): self
  93. {
  94. if ($this->productFamilies->contains($productFamily)) {
  95. $this->productFamilies->removeElement($productFamily);
  96. }
  97. return $this;
  98. }
  99. public function getProductFamily(): ?ProductFamilyInterface
  100. {
  101. return $this->productFamily;
  102. }
  103. public function setProductFamily(?ProductFamilyInterface $productFamily): self
  104. {
  105. $this->productFamily = $productFamily;
  106. return $this;
  107. }
  108. /**
  109. * @return Collection|ProductCategoryInterface[]
  110. */
  111. public function getProductCategories(): Collection
  112. {
  113. return $this->productCategories;
  114. }
  115. public function addProductCategory(ProductCategoryInterface $productCategory): self
  116. {
  117. if (!$this->productCategories->contains($productCategory)) {
  118. $this->productCategories[] = $productCategory;
  119. }
  120. return $this;
  121. }
  122. public function removeProductCategory(ProductCategoryInterface $productCategory): self
  123. {
  124. if ($this->productCategories->contains($productCategory)) {
  125. $this->productCategories->removeElement($productCategory);
  126. }
  127. return $this;
  128. }
  129. public function getIsDisplayed(): bool
  130. {
  131. return $this->isDisplayed;
  132. }
  133. public function isDisplayed(): bool
  134. {
  135. return $this->isDisplayed;
  136. }
  137. public function setIsDisplayed(bool $isDisplayed): self
  138. {
  139. $this->isDisplayed = $isDisplayed;
  140. return $this;
  141. }
  142. }