|
- <?php
-
- namespace Lc\ShopBundle\Model;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\ShopBundle\Context\ProductInterface;
- use Lc\ShopBundle\Context\ProductPropertyInterface;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class ProductFamily extends AbstractDocumentEntity implements ProductPropertyInterface
- {
- use ProductPropertyTrait;
-
- /**
- * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="productFamilies")
- * @ORM\JoinColumn(nullable=false)
- */
- protected $merchant;
-
- /**
- * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", inversedBy="productFamilies")
- */
- protected $productCategories;
-
- /**
- * @ORM\Column(type="boolean")
- */
- protected $activeProducts;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $productsType;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductInterface", mappedBy="productFamily", orphanRemoval=true, cascade={"persist"})
- */
- protected $products;
-
- /**
- * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
- * @ORM\JoinColumn(nullable=true)
- */
- protected $taxRate;
-
- /**
- * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
- */
- protected $supplierTaxRate;
-
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $subTitle;
-
-
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- protected $note;
-
-
- /**
- * @ORM\Column(type="string", length=31, nullable=true)
- */
- protected $behaviorOutOfStock;
-
- /**
- * @ORM\Column(type="string", length=31)
- */
- protected $behaviorCountStock;
-
- /**
- * @ORM\Column(type="boolean", nullable=true)
- */
- protected $isNovelty;
-
- /**
- * @ORM\Column(type="date", nullable=true)
- */
- protected $noveltyExpirationDate;
-
- /**
- * @ORM\Column(type="boolean", nullable=true)
- */
- protected $isOrganic;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $organicLabel;
-
-
- public function __construct()
- {
- $this->productCategories = new ArrayCollection();
- $this->products = new ArrayCollection();
- }
-
- public function getMerchant(): ?Merchant
- {
- return $this->merchant;
- }
-
- public function setMerchant(?Merchant $merchant): self
- {
- $this->merchant = $merchant;
-
- return $this;
- }
-
- public function getActiveProducts(): ?bool
- {
- return $this->activeProducts;
- }
-
- public function setActiveProducts(bool $activeProducts): self
- {
- $this->activeProducts = $activeProducts;
-
- return $this;
- }
-
- public function getProductsType(): ?string
- {
- return $this->productsType;
- }
-
- public function setProductsType(?string $productsType): self
- {
- $this->productsType = $productsType;
-
- return $this;
- }
-
- /**
- * @return Collection|ProductInterface[]
- */
- public function getProducts(): Collection
- {
- return $this->products;
- }
-
- public function addProduct(ProductInterface $product): self
- {
- if (!$this->products->contains($product)) {
- $this->products[] = $product;
- $product->setProductFamily($this);
- }
-
- return $this;
- }
-
- public function removeProduct(ProductInterface $product): self
- {
- if ($this->products->contains($product)) {
- $this->products->removeElement($product);
- // set the owning side to null (unless already changed)
- if ($product->getProductFamily() === $this) {
- $product->setProductFamily(null);
- }
- }
-
- return $this;
- }
-
- /**
- * @return Collection|ProductCategory[]
- */
- public function getProductCategories(): Collection
- {
- return $this->productCategories;
- }
-
- public function initProductCategories()
- {
- $this->productCategories = new ArrayCollection();
- }
-
- public function addProductCategory(ProductCategory $productCategory): self
- {
- if (!$this->productCategories->contains($productCategory)) {
- $this->productCategories[] = $productCategory;
- }
-
- return $this;
- }
-
- public function removeProductCategory(ProductCategory $productCategory): self
- {
- if ($this->productCategories->contains($productCategory)) {
- $this->productCategories->removeElement($productCategory);
- }
-
- return $this;
- }
-
- public function getTaxRate(): ?TaxRate
- {
- return $this->taxRate;
- }
-
- public function setTaxRate(?TaxRate $taxRate): self
- {
- $this->taxRate = $taxRate;
-
- return $this;
- }
-
-
- public function getSupplierTaxRate(): ?TaxRate
- {
- return $this->supplierTaxRate;
- }
-
- public function setSupplierTaxRate(?TaxRate $supplierTaxRate): self
- {
- $this->supplierTaxRate = $supplierTaxRate;
-
- return $this;
- }
-
- public function getSubTitle(): ?string
- {
- return $this->subTitle;
- }
-
- public function setSubTitle(?string $subTitle): self
- {
- $this->subTitle = $subTitle;
-
- return $this;
- }
-
-
- public function getNote(): ?string
- {
- return $this->note;
- }
-
- public function setNote(?string $note): self
- {
- $this->note = $note;
-
- return $this;
- }
-
-
-
- public function getBehaviorOutOfStock(): ?string
- {
- return $this->behaviorOutOfStock;
- }
-
- public function setBehaviorOutOfStock(?string $behaviorOutOfStock): self
- {
- $this->behaviorOutOfStock = $behaviorOutOfStock;
-
- return $this;
- }
-
- public function getBehaviorCountStock(): ?string
- {
- return $this->behaviorCountStock;
- }
-
-
- public function setBehaviorCountStock(string $behaviorCountStock): self
- {
- $this->behaviorCountStock = $behaviorCountStock;
-
- return $this;
- }
-
-
- public function getIsNovelty(): ?bool
- {
- return $this->isNovelty;
- }
-
- public function setIsNovelty(?bool $isNovelty): self
- {
- $this->isNovelty = $isNovelty;
-
- return $this;
- }
-
- public function getNoveltyExpirationDate(): ?\DateTimeInterface
- {
- return $this->noveltyExpirationDate;
- }
-
- public function setNoveltyExpirationDate(?\DateTimeInterface $noveltyExpirationDate): self
- {
- $this->noveltyExpirationDate = $noveltyExpirationDate;
-
- return $this;
- }
-
-
- public function getIsOrganic(): ?bool
- {
- return $this->isOrganic;
- }
-
- public function setIsOrganic(?bool $isOrganic): self
- {
- $this->isOrganic = $isOrganic;
-
- return $this;
- }
-
- public function getOrganicLabel(): ?string
- {
- return $this->organicLabel;
- }
-
- public function setOrganicLabel(?string $organicLabel): self
- {
- $this->organicLabel = $organicLabel;
-
- return $this;
- }
-
-
- }
|