You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ReductionCatalogModel.php 4.2KB

пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
пре 3 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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, StatusInterface
  22. {
  23. use StatusTrait;
  24. use ReductionTrait;
  25. use ReductionPropertyTrait {
  26. ReductionPropertyTrait::__construct as private __reductionPropertyConstruct;
  27. }
  28. /**
  29. * @ORM\Column(type="string", length=255)
  30. */
  31. protected $title;
  32. /**
  33. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface")
  34. * @ORM\JoinColumn(nullable=false)
  35. */
  36. protected $merchant;
  37. /**
  38. * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
  39. */
  40. protected $productFamilies;
  41. /**
  42. * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
  43. */
  44. protected $productFamily;
  45. /**
  46. * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface")
  47. */
  48. protected $productCategories;
  49. public function __construct()
  50. {
  51. $this->__reductionPropertyConstruct();
  52. $this->productFamilies = new ArrayCollection();
  53. $this->productCategories = new ArrayCollection();
  54. }
  55. public function getTitle(): ?string
  56. {
  57. return $this->title;
  58. }
  59. public function setTitle(string $title): self
  60. {
  61. $this->title = $title;
  62. return $this;
  63. }
  64. public function getMerchant(): ?MerchantInterface
  65. {
  66. return $this->merchant;
  67. }
  68. public function setMerchant(?MerchantInterface $merchant): self
  69. {
  70. $this->merchant = $merchant;
  71. return $this;
  72. }
  73. /**
  74. * @return Collection|ProductFamilyInterface[]
  75. */
  76. public function getProductFamilies(): Collection
  77. {
  78. return $this->productFamilies;
  79. }
  80. public function addProductFamily(ProductFamilyInterface $productFamily): self
  81. {
  82. if (!$this->productFamilies->contains($productFamily)) {
  83. $this->productFamilies[] = $productFamily;
  84. }
  85. return $this;
  86. }
  87. public function removeProductFamily(ProductFamilyInterface $productFamily): self
  88. {
  89. if ($this->productFamilies->contains($productFamily)) {
  90. $this->productFamilies->removeElement($productFamily);
  91. }
  92. return $this;
  93. }
  94. public function getProductFamily(): ?ProductFamily
  95. {
  96. return $this->productFamily;
  97. }
  98. public function setProductFamily(?ProductFamily $productFamily): self
  99. {
  100. $this->productFamily = $productFamily;
  101. return $this;
  102. }
  103. /**
  104. * @return Collection|ProductCategoryInterface[]
  105. */
  106. public function getProductCategories(): Collection
  107. {
  108. return $this->productCategories;
  109. }
  110. public function addProductCategory(ProductCategoryInterface $productCategory): self
  111. {
  112. if (!$this->productCategories->contains($productCategory)) {
  113. $this->productCategories[] = $productCategory;
  114. }
  115. return $this;
  116. }
  117. public function removeProductCategory(ProductCategoryInterface $productCategory): self
  118. {
  119. if ($this->productCategories->contains($productCategory)) {
  120. $this->productCategories->removeElement($productCategory);
  121. }
  122. return $this;
  123. }
  124. }