|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <?php
-
- namespace Lc\ShopBundle\Model;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class Merchant extends AbstractDocumentEntity
- {
- /**
- * @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\CreditConfigInterface", cascade={"persist", "remove"})
- * @ORM\JoinColumn(nullable=true)
- */
- protected $creditConfig;
-
- /**
- * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
- * @ORM\JoinColumn(nullable=false)
- */
- protected $taxRate;
-
- /**
- * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\PointSaleInterface", mappedBy="merchant")
- */
- protected $pointSales;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", mappedBy="merchant")
- */
- protected $productFamilies;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\MerchantConfigInterface", mappedBy="merchant", orphanRemoval=true)
- */
- protected $merchantConfigs;
-
- /**
- * @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface", inversedBy="merchant", cascade={"persist", "remove"})
- * @ORM\JoinColumn(nullable=true)
- */
- protected $address;
-
- public function __construct()
- {
- $this->pointSales = new ArrayCollection();
- $this->productFamilies = new ArrayCollection();
- $this->merchantConfigs = new ArrayCollection();
- }
-
- public function getCreditConfig(): ?CreditConfig
- {
- return $this->creditConfig;
- }
-
- public function setCreditConfig(CreditConfig $creditConfig): self
- {
- $this->creditConfig = $creditConfig;
-
- return $this;
- }
-
- public function getTaxRate(): ?TaxRate
- {
- return $this->taxRate;
- }
-
- public function setTaxRate(?TaxRate $taxRate): self
- {
- $this->taxRate = $taxRate;
-
- return $this;
- }
-
- /**
- * @return Collection|PointSale[]
- */
- public function getPointSales(): Collection
- {
- return $this->pointSales;
- }
-
- public function addPointSale(PointSale $pointSale): self
- {
- if (!$this->pointSales->contains($pointSale)) {
- $this->pointSales[] = $pointSale;
- $pointSale->addMerchant($this);
- }
-
- return $this;
- }
-
- public function removePointSale(PointSale $pointSale): self
- {
- if ($this->pointSales->contains($pointSale)) {
- $this->pointSales->removeElement($pointSale);
- $pointSale->removeMerchant($this);
- }
-
- return $this;
- }
-
- /**
- * @return Collection|ProductFamily[]
- */
- public function getProductFamilies(): Collection
- {
- return $this->productFamilies;
- }
-
- public function addProductFamily(ProductFamily $productFamily): self
- {
- if (!$this->productFamilies->contains($productFamily)) {
- $this->productFamilies[] = $productFamily;
- $productFamily->setMerchant($this);
- }
-
- return $this;
- }
-
- public function removeProductFamily(ProductFamily $productFamily): self
- {
- if ($this->productFamilies->contains($productFamily)) {
- $this->productFamilies->removeElement($productFamily);
- // set the owning side to null (unless already changed)
- if ($productFamily->getMerchant() === $this) {
- $productFamily->setMerchant(null);
- }
- }
-
- return $this;
- }
-
- /**
- * @return Collection|MerchantConfig[]
- */
- public function getMerchantConfigs(): Collection
- {
- return $this->merchantConfigs;
- }
-
- public function addMerchantConfig(MerchantConfig $merchantConfig): self
- {
- if (!$this->merchantConfigs->contains($merchantConfig)) {
- $this->merchantConfigs[] = $merchantConfig;
- $merchantConfig->setMerchant($this);
- }
-
- return $this;
- }
-
- public function removeMerchantConfig(MerchantConfig $merchantConfig): self
- {
- if ($this->merchantConfigs->contains($merchantConfig)) {
- $this->merchantConfigs->removeElement($merchantConfig);
- // set the owning side to null (unless already changed)
- if ($merchantConfig->getMerchant() === $this) {
- $merchantConfig->setMerchant(null);
- }
- }
-
- return $this;
- }
-
- public function getAddress(): ?Address
- {
- return $this->address;
- }
-
- public function setAddress(Address $address): self
- {
- $this->address = $address;
-
- return $this;
- }
- }
|