|
- <?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;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class ProductFamily extends AbstractDocumentEntity
- {
- /**
- * @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\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\Column(type="float", nullable=true)
- */
- protected $price;
-
- /**
- * @ORM\Column(type="string", length=31, nullable=true)
- */
- protected $unit;
-
- /**
- * @ORM\Column(type="float", nullable=true)
- */
- protected $step;
-
- /**
- * @ORM\Column(type="float", nullable=true)
- */
- protected $weight;
-
- /**
- * @ORM\Column(type="float", nullable=true)
- */
- protected $stock;
-
- /**
- * @ORM\Column(type="float", nullable=true)
- */
- protected $availableQuantity;
-
- /**
- * @ORM\Column(type="string", length=31, nullable=true)
- */
- protected $behaviorOutOfStock;
-
- /**
- * @ORM\Column(type="string", length=31)
- */
- protected $behaviorCountStock;
-
-
- /**
- * @ORM\Column(type="boolean")
- */
- protected $activeProducts;
-
- 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;
- }
-
- /**
- * @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 getUnit(): ?string
- {
- return $this->unit;
- }
-
- public function setUnit(?string $unit): self
- {
- $this->unit = $unit;
-
- return $this;
- }
-
- public function getPrice(): ?float
- {
- return $this->price;
- }
-
- public function setPrice(?float $price): self
- {
- $this->price = $price;
-
- return $this;
- }
-
- public function getStep(): ?float
- {
- return $this->step;
- }
-
- public function setStep(?float $step): self
- {
- $this->step = $step;
-
- return $this;
- }
-
- public function getWeight(): ?float
- {
- return $this->weight;
- }
-
- public function setWeight(?float $weight): self
- {
- $this->weight = $weight;
-
- return $this;
- }
-
- public function getStock(): ?float
- {
- return $this->stock;
- }
-
- public function setStock(?float $stock): self
- {
- $this->stock = $stock;
-
- return $this;
- }
-
- public function getAvailableQuantity(): ?float
- {
- return $this->availableQuantity;
- }
-
- public function setAvailableQuantity(?float $availableQuantity): self
- {
- $this->availableQuantity = $availableQuantity;
-
- 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 getActiveProducts(): ?bool
- {
- return $this->activeProducts;
- }
-
- public function setActiveProducts(bool $activeProducts): self
- {
- $this->activeProducts = $activeProducts;
-
- return $this;
- }
- }
|