Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

122 rindas
3.4KB

  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * @ORM\MappedSuperclass()
  8. */
  9. abstract class PointSale extends AbstractDocumentEntity
  10. {
  11. /**
  12. * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="pointSales")
  13. */
  14. protected $merchant;
  15. /**
  16. * @ORM\Column(type="string", length=63, nullable=true)
  17. */
  18. protected $code;
  19. /**
  20. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\PointSaleDayInfoInterface", mappedBy="pointSale", orphanRemoval=true)
  21. */
  22. protected $pointSaleDayInfos;
  23. /**
  24. * @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface", inversedBy="pointSale", cascade={"persist", "remove"})
  25. * @ORM\JoinColumn(nullable=false)
  26. */
  27. protected $address;
  28. public function __construct()
  29. {
  30. $this->merchant = new ArrayCollection();
  31. $this->pointSaleDayInfos = new ArrayCollection();
  32. }
  33. /**
  34. * @return Collection|Merchant[]
  35. */
  36. public function getMerchant(): Collection
  37. {
  38. return $this->merchant;
  39. }
  40. public function addMerchant(Merchant $merchant): self
  41. {
  42. if (!$this->merchant->contains($merchant)) {
  43. $this->merchant[] = $merchant;
  44. }
  45. return $this;
  46. }
  47. public function removeMerchant(Merchant $merchant): self
  48. {
  49. if ($this->merchant->contains($merchant)) {
  50. $this->merchant->removeElement($merchant);
  51. }
  52. return $this;
  53. }
  54. public function getCode(): ?string
  55. {
  56. return $this->code;
  57. }
  58. public function setCode(?string $code): self
  59. {
  60. $this->code = $code;
  61. return $this;
  62. }
  63. /**
  64. * @return Collection|PointSaleDayInfo[]
  65. */
  66. public function getPointSaleDayInfos(): Collection
  67. {
  68. return $this->pointSaleDayInfos;
  69. }
  70. public function addPointSaleDayInfo(PointSaleDayInfo $pointSaleDayInfo): self
  71. {
  72. if (!$this->pointSaleDayInfos->contains($pointSaleDayInfo)) {
  73. $this->pointSaleDayInfos[] = $pointSaleDayInfo;
  74. $pointSaleDayInfo->setPointSale($this);
  75. }
  76. return $this;
  77. }
  78. public function removePointSaleDayInfo(PointSaleDayInfo $pointSaleDayInfo): self
  79. {
  80. if ($this->pointSaleDayInfos->contains($pointSaleDayInfo)) {
  81. $this->pointSaleDayInfos->removeElement($pointSaleDayInfo);
  82. // set the owning side to null (unless already changed)
  83. if ($pointSaleDayInfo->getPointSale() === $this) {
  84. $pointSaleDayInfo->setPointSale(null);
  85. }
  86. }
  87. return $this;
  88. }
  89. public function getAddress(): ?Address
  90. {
  91. return $this->address;
  92. }
  93. public function setAddress(Address $address): self
  94. {
  95. $this->address = $address;
  96. return $this;
  97. }
  98. }