<?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\FilterMerchantInterface; use Lc\ShopBundle\Context\OrderAmountMinInterface; use Lc\ShopBundle\Context\ReductionCartPropertyInterface; use Lc\ShopBundle\Context\ReductionInterface; use Lc\ShopBundle\Context\ReductionPropertyInterface; use Lc\ShopBundle\Context\StatusInterface; /** * @ORM\MappedSuperclass() */ abstract class ReductionCart extends AbstractEntity implements ReductionPropertyInterface, ReductionInterface, ReductionCartPropertyInterface, FilterMerchantInterface, OrderAmountMinInterface, StatusInterface { const APPLIED_TO_DELIVERY = 'delivery'; const APPLIED_TO_ORDER_PRODUCTS = 'order-products'; use StatusTrait; use OrderAmountMin; use ReductionTrait; use ReductionCartPropertyTrait; use ReductionPropertyTrait { ReductionPropertyTrait::__construct as private __reductionPropertyConstruct; } /** * @ORM\Column(type="string", length=255) */ protected $title; /** * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface") * @ORM\JoinColumn(nullable=false) */ protected $merchant; /** * @ORM\Column(type="array", nullable=true) */ protected $codes = []; /** * @ORM\Column(type="integer") */ protected $availableQuantity; /** * @ORM\Column(type="integer") */ protected $availableQuantityPerUser; /** * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\PointSaleInterface") */ protected $pointSales; /** * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ReductionCartInterface") */ protected $uncombinables; /** * @ORM\Column(type="array", nullable=true) */ protected $uncombinableTypes = []; public function __toString() { return $this->title; } public function __construct() { $this->__reductionPropertyConstruct(); $this->pointSales = new ArrayCollection(); $this->uncombinables = new ArrayCollection(); } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getMerchant(): ?Merchant { return $this->merchant; } public function setMerchant(?Merchant $merchant): self { $this->merchant = $merchant; return $this; } public function getCodes(): ?array { return $this->codes; } public function setCodes(?array $codes): self { $this->codes = $codes; 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; } return $this; } public function removePointSale(PointSale $pointSale): self { if ($this->pointSales->contains($pointSale)) { $this->pointSales->removeElement($pointSale); } return $this; } public function getAvailableQuantity(): ?int { return $this->availableQuantity; } public function setAvailableQuantity(int $availableQuantity): self { $this->availableQuantity = $availableQuantity; return $this; } public function getAvailableQuantityPerUser(): ?int { return $this->availableQuantityPerUser; } public function setAvailableQuantityPerUser(int $availableQuantityPerUser): self { $this->availableQuantityPerUser = $availableQuantityPerUser; return $this; } /** * @return Collection|self[] */ public function getUncombinables(): Collection { return $this->uncombinables; } public function addUncombinable(self $uncombinable): self { if (!$this->uncombinables->contains($uncombinable)) { $this->uncombinables[] = $uncombinable; } return $this; } public function removeUncombinables(self $uncombinable): self { if ($this->uncombinables->contains($uncombinable)) { $this->uncombinables->removeElement($uncombinable); } return $this; } public function getUncombinableTypes(): ?array { return $this->uncombinableTypes; } public function setUncombinableTypes(?array $uncombinableTypes): self { $this->uncombinableTypes = $uncombinableTypes; return $this; } }