<?php namespace Lc\CaracoleBundle\Model\Reduction; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; use Lc\CaracoleBundle\Doctrine\Extension\ReductionPropertyTrait; use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait; use Lc\CaracoleBundle\Doctrine\Extension\ReductionPropertyInterface; use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; use Lc\SovBundle\Doctrine\Extension\StatusInterface; use Lc\SovBundle\Doctrine\Extension\StatusTrait; use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; /** * @ORM\MappedSuperclass() */ abstract class ReductionCatalogModel extends AbstractLightEntity implements ReductionCatalogInterface, ReductionPropertyInterface, FilterMerchantInterface, StatusInterface { use StatusTrait; use ReductionTrait; use ReductionPropertyTrait { ReductionPropertyTrait::__construct as private __reductionPropertyConstruct; } /** * @ORM\Column(type="string", length=255) */ protected $title; /** * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface") * @ORM\JoinColumn(nullable=false) */ protected $merchant; /** * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface") */ protected $productFamilies; /** * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface") */ protected $productFamily; /** * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface") */ protected $productCategories; public function __construct() { $this->__reductionPropertyConstruct(); $this->productFamilies = new ArrayCollection(); $this->productCategories = new ArrayCollection(); } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getMerchant(): MerchantInterface { return $this->merchant; } public function setMerchant(MerchantInterface $merchant): self { $this->merchant = $merchant; return $this; } /** * @return Collection|ProductFamilyInterface[] */ public function getProductFamilies(): Collection { return $this->productFamilies; } public function addProductFamily(ProductFamilyInterface $productFamily): self { if (!$this->productFamilies->contains($productFamily)) { $this->productFamilies[] = $productFamily; } return $this; } public function removeProductFamily(ProductFamilyInterface $productFamily): self { if ($this->productFamilies->contains($productFamily)) { $this->productFamilies->removeElement($productFamily); } return $this; } public function getProductFamily(): ?ProductFamilyInterface { return $this->productFamily; } public function setProductFamily(?ProductFamilyInterface $productFamily): self { $this->productFamily = $productFamily; return $this; } /** * @return Collection|ProductCategoryInterface[] */ public function getProductCategories(): Collection { return $this->productCategories; } public function addProductCategory(ProductCategoryInterface $productCategory): self { if (!$this->productCategories->contains($productCategory)) { $this->productCategories[] = $productCategory; } return $this; } public function removeProductCategory(ProductCategoryInterface $productCategory): self { if ($this->productCategories->contains($productCategory)) { $this->productCategories->removeElement($productCategory); } return $this; } }