Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

PointSale.php 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. public function __toString()
  34. {
  35. return $this->getTitle() ;
  36. }
  37. /**
  38. * @return Collection|Merchant[]
  39. */
  40. public function getMerchant(): Collection
  41. {
  42. return $this->merchant;
  43. }
  44. public function addMerchant(Merchant $merchant): self
  45. {
  46. if (!$this->merchant->contains($merchant)) {
  47. $this->merchant[] = $merchant;
  48. }
  49. return $this;
  50. }
  51. public function removeMerchant(Merchant $merchant): self
  52. {
  53. if ($this->merchant->contains($merchant)) {
  54. $this->merchant->removeElement($merchant);
  55. }
  56. return $this;
  57. }
  58. public function getCode(): ?string
  59. {
  60. return $this->code;
  61. }
  62. public function setCode(?string $code): self
  63. {
  64. $this->code = $code;
  65. return $this;
  66. }
  67. /**
  68. * @return Collection|PointSaleDayInfo[]
  69. */
  70. public function getPointSaleDayInfos(): Collection
  71. {
  72. return $this->pointSaleDayInfos;
  73. }
  74. public function addPointSaleDayInfo(PointSaleDayInfo $pointSaleDayInfo): self
  75. {
  76. if (!$this->pointSaleDayInfos->contains($pointSaleDayInfo)) {
  77. $this->pointSaleDayInfos[] = $pointSaleDayInfo;
  78. $pointSaleDayInfo->setPointSale($this);
  79. }
  80. return $this;
  81. }
  82. public function removePointSaleDayInfo(PointSaleDayInfo $pointSaleDayInfo): self
  83. {
  84. if ($this->pointSaleDayInfos->contains($pointSaleDayInfo)) {
  85. $this->pointSaleDayInfos->removeElement($pointSaleDayInfo);
  86. // set the owning side to null (unless already changed)
  87. if ($pointSaleDayInfo->getPointSale() === $this) {
  88. $pointSaleDayInfo->setPointSale(null);
  89. }
  90. }
  91. return $this;
  92. }
  93. public function getAddress(): ?Address
  94. {
  95. return $this->address;
  96. }
  97. public function setAddress(Address $address): self
  98. {
  99. $this->address = $address;
  100. return $this;
  101. }
  102. }