|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?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 PointSale extends AbstractDocumentEntity
- {
- /**
- * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="pointSales")
- */
- protected $merchant;
-
- /**
- * @ORM\Column(type="string", length=63, nullable=true)
- */
- protected $code;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\PointSaleDayInfoInterface", mappedBy="pointSale", orphanRemoval=true)
- */
- protected $pointSaleDayInfos;
-
- /**
- * @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface", inversedBy="pointSale", cascade={"persist", "remove"})
- * @ORM\JoinColumn(nullable=false)
- */
- protected $address;
-
- public function __construct()
- {
- $this->merchant = new ArrayCollection();
- $this->pointSaleDayInfos = new ArrayCollection();
- }
-
- public function __toString()
- {
- return $this->getTitle() ;
- }
-
- /**
- * @return Collection|Merchant[]
- */
- public function getMerchant(): Collection
- {
- return $this->merchant;
- }
-
- public function addMerchant(Merchant $merchant): self
- {
- if (!$this->merchant->contains($merchant)) {
- $this->merchant[] = $merchant;
- }
-
- return $this;
- }
-
- public function removeMerchant(Merchant $merchant): self
- {
- if ($this->merchant->contains($merchant)) {
- $this->merchant->removeElement($merchant);
- }
-
- return $this;
- }
-
- public function getCode(): ?string
- {
- return $this->code;
- }
-
- public function setCode(?string $code): self
- {
- $this->code = $code;
-
- return $this;
- }
-
- /**
- * @return Collection|PointSaleDayInfo[]
- */
- public function getPointSaleDayInfos(): Collection
- {
- return $this->pointSaleDayInfos;
- }
-
- public function addPointSaleDayInfo(PointSaleDayInfo $pointSaleDayInfo): self
- {
- if (!$this->pointSaleDayInfos->contains($pointSaleDayInfo)) {
- $this->pointSaleDayInfos[] = $pointSaleDayInfo;
- $pointSaleDayInfo->setPointSale($this);
- }
-
- return $this;
- }
-
- public function removePointSaleDayInfo(PointSaleDayInfo $pointSaleDayInfo): self
- {
- if ($this->pointSaleDayInfos->contains($pointSaleDayInfo)) {
- $this->pointSaleDayInfos->removeElement($pointSaleDayInfo);
- // set the owning side to null (unless already changed)
- if ($pointSaleDayInfo->getPointSale() === $this) {
- $pointSaleDayInfo->setPointSale(null);
- }
- }
-
- return $this;
- }
-
- public function getAddress(): ?Address
- {
- return $this->address;
- }
-
- public function setAddress(Address $address): self
- {
- $this->address = $address;
-
- return $this;
- }
- }
|