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.

332 lines
8.2KB

  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\ProductInterface;
  7. use Lc\ShopBundle\Context\ProductPropertyInterface;
  8. /**
  9. * @ORM\MappedSuperclass()
  10. */
  11. abstract class ProductFamily extends AbstractDocumentEntity implements ProductPropertyInterface
  12. {
  13. use ProductPropertyTrait;
  14. /**
  15. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="productFamilies")
  16. * @ORM\JoinColumn(nullable=false)
  17. */
  18. protected $merchant;
  19. /**
  20. * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", inversedBy="productFamilies")
  21. */
  22. protected $productCategories;
  23. /**
  24. * @ORM\Column(type="boolean")
  25. */
  26. protected $activeProducts;
  27. /**
  28. * @ORM\Column(type="string", length=255, nullable=true)
  29. */
  30. protected $productsType;
  31. /**
  32. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductInterface", mappedBy="productFamily", orphanRemoval=true, cascade={"persist"})
  33. */
  34. protected $products;
  35. /**
  36. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
  37. * @ORM\JoinColumn(nullable=true)
  38. */
  39. protected $taxRate;
  40. /**
  41. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
  42. */
  43. protected $supplierTaxRate;
  44. /**
  45. * @ORM\Column(type="string", length=255, nullable=true)
  46. */
  47. protected $subTitle;
  48. /**
  49. * @ORM\Column(type="text", nullable=true)
  50. */
  51. protected $note;
  52. /**
  53. * @ORM\Column(type="string", length=31, nullable=true)
  54. */
  55. protected $behaviorOutOfStock;
  56. /**
  57. * @ORM\Column(type="string", length=31)
  58. */
  59. protected $behaviorCountStock;
  60. /**
  61. * @ORM\Column(type="boolean", nullable=true)
  62. */
  63. protected $isNovelty;
  64. /**
  65. * @ORM\Column(type="date", nullable=true)
  66. */
  67. protected $noveltyExpirationDate;
  68. /**
  69. * @ORM\Column(type="boolean", nullable=true)
  70. */
  71. protected $isOrganic;
  72. /**
  73. * @ORM\Column(type="string", length=255, nullable=true)
  74. */
  75. protected $organicLabel;
  76. public function __construct()
  77. {
  78. $this->productCategories = new ArrayCollection();
  79. $this->products = new ArrayCollection();
  80. }
  81. public function getMerchant(): ?Merchant
  82. {
  83. return $this->merchant;
  84. }
  85. public function setMerchant(?Merchant $merchant): self
  86. {
  87. $this->merchant = $merchant;
  88. return $this;
  89. }
  90. public function getActiveProducts(): ?bool
  91. {
  92. return $this->activeProducts;
  93. }
  94. public function setActiveProducts(bool $activeProducts): self
  95. {
  96. $this->activeProducts = $activeProducts;
  97. return $this;
  98. }
  99. public function getProductsType(): ?string
  100. {
  101. return $this->productsType;
  102. }
  103. public function setProductsType(?string $productsType): self
  104. {
  105. $this->productsType = $productsType;
  106. return $this;
  107. }
  108. /**
  109. * @return Collection|ProductInterface[]
  110. */
  111. public function getProducts(): Collection
  112. {
  113. return $this->products;
  114. }
  115. public function addProduct(ProductInterface $product): self
  116. {
  117. if (!$this->products->contains($product)) {
  118. $this->products[] = $product;
  119. $product->setProductFamily($this);
  120. }
  121. return $this;
  122. }
  123. public function removeProduct(ProductInterface $product): self
  124. {
  125. if ($this->products->contains($product)) {
  126. $this->products->removeElement($product);
  127. // set the owning side to null (unless already changed)
  128. if ($product->getProductFamily() === $this) {
  129. $product->setProductFamily(null);
  130. }
  131. }
  132. return $this;
  133. }
  134. /**
  135. * @return Collection|ProductCategory[]
  136. */
  137. public function getProductCategories(): Collection
  138. {
  139. return $this->productCategories;
  140. }
  141. public function initProductCategories()
  142. {
  143. $this->productCategories = new ArrayCollection();
  144. }
  145. public function addProductCategory(ProductCategory $productCategory): self
  146. {
  147. if (!$this->productCategories->contains($productCategory)) {
  148. $this->productCategories[] = $productCategory;
  149. }
  150. return $this;
  151. }
  152. public function removeProductCategory(ProductCategory $productCategory): self
  153. {
  154. if ($this->productCategories->contains($productCategory)) {
  155. $this->productCategories->removeElement($productCategory);
  156. }
  157. return $this;
  158. }
  159. public function getTaxRate(): ?TaxRate
  160. {
  161. return $this->taxRate;
  162. }
  163. public function setTaxRate(?TaxRate $taxRate): self
  164. {
  165. $this->taxRate = $taxRate;
  166. return $this;
  167. }
  168. public function getSupplierTaxRate(): ?TaxRate
  169. {
  170. return $this->supplierTaxRate;
  171. }
  172. public function setSupplierTaxRate(?TaxRate $supplierTaxRate): self
  173. {
  174. $this->supplierTaxRate = $supplierTaxRate;
  175. return $this;
  176. }
  177. public function getSubTitle(): ?string
  178. {
  179. return $this->subTitle;
  180. }
  181. public function setSubTitle(?string $subTitle): self
  182. {
  183. $this->subTitle = $subTitle;
  184. return $this;
  185. }
  186. public function getNote(): ?string
  187. {
  188. return $this->note;
  189. }
  190. public function setNote(?string $note): self
  191. {
  192. $this->note = $note;
  193. return $this;
  194. }
  195. public function getBehaviorOutOfStock(): ?string
  196. {
  197. return $this->behaviorOutOfStock;
  198. }
  199. public function setBehaviorOutOfStock(?string $behaviorOutOfStock): self
  200. {
  201. $this->behaviorOutOfStock = $behaviorOutOfStock;
  202. return $this;
  203. }
  204. public function getBehaviorCountStock(): ?string
  205. {
  206. return $this->behaviorCountStock;
  207. }
  208. public function setBehaviorCountStock(string $behaviorCountStock): self
  209. {
  210. $this->behaviorCountStock = $behaviorCountStock;
  211. return $this;
  212. }
  213. public function getIsNovelty(): ?bool
  214. {
  215. return $this->isNovelty;
  216. }
  217. public function setIsNovelty(?bool $isNovelty): self
  218. {
  219. $this->isNovelty = $isNovelty;
  220. return $this;
  221. }
  222. public function getNoveltyExpirationDate(): ?\DateTimeInterface
  223. {
  224. return $this->noveltyExpirationDate;
  225. }
  226. public function setNoveltyExpirationDate(?\DateTimeInterface $noveltyExpirationDate): self
  227. {
  228. $this->noveltyExpirationDate = $noveltyExpirationDate;
  229. return $this;
  230. }
  231. public function getIsOrganic(): ?bool
  232. {
  233. return $this->isOrganic;
  234. }
  235. public function setIsOrganic(?bool $isOrganic): self
  236. {
  237. $this->isOrganic = $isOrganic;
  238. return $this;
  239. }
  240. public function getOrganicLabel(): ?string
  241. {
  242. return $this->organicLabel;
  243. }
  244. public function setOrganicLabel(?string $organicLabel): self
  245. {
  246. $this->organicLabel = $organicLabel;
  247. return $this;
  248. }
  249. }