Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

PointSale.php 3.7KB

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