You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PointSaleModel.php 4.5KB

3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. namespace Lc\CaracoleBundle\Model\PointSale;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Lc\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface;
  7. use Lc\CaracoleBundle\Doctrine\Extension\OrderAmountMinTrait;
  8. use Lc\CaracoleBundle\Doctrine\Extension\OrderAmountMinInterface;
  9. use Lc\CaracoleBundle\Model\Address\AddressInterface;
  10. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  11. use Lc\CaracoleBundle\Model\User\UserPointSaleInterface;
  12. use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
  13. use App\Entity\File\File;
  14. /**
  15. * @ORM\MappedSuperclass()
  16. */
  17. abstract class PointSaleModel extends AbstractFullEntity implements FilterMultipleMerchantsInterface,
  18. OrderAmountMinInterface
  19. {
  20. use OrderAmountMinTrait;
  21. /**
  22. * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="pointSales")
  23. */
  24. protected $merchants;
  25. /**
  26. * @ORM\Column(type="string", length=63, nullable=true)
  27. */
  28. protected $code;
  29. /**
  30. * @ORM\Column(type="float")
  31. */
  32. protected $deliveryPrice;
  33. /**
  34. * @ORM\Column(type="boolean")
  35. */
  36. protected $isPublic;
  37. /**
  38. * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface", inversedBy="pointSale", cascade={"persist", "remove"})
  39. * @ORM\JoinColumn(nullable=false)
  40. */
  41. protected $address;
  42. /**
  43. * @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserPointSaleInterface", mappedBy="pointSale", orphanRemoval=true)
  44. */
  45. protected $userPointSales;
  46. /**
  47. * @ORM\ManyToOne(targetEntity=File::class, cascade={"persist", "remove"})
  48. */
  49. protected $image;
  50. public function __construct()
  51. {
  52. $this->merchants = new ArrayCollection();
  53. $this->userPointSales = new ArrayCollection();
  54. }
  55. public function __toString()
  56. {
  57. return $this->getTitle();
  58. }
  59. /**
  60. * @return Collection|MerchantInterface[]
  61. */
  62. public function getMerchants(): Collection
  63. {
  64. return $this->merchants;
  65. }
  66. public function addMerchant(MerchantInterface $merchant): self
  67. {
  68. if (!$this->merchants->contains($merchant)) {
  69. $this->merchants[] = $merchant;
  70. }
  71. return $this;
  72. }
  73. public function removeMerchant(MerchantInterface $merchant): self
  74. {
  75. if ($this->merchants->contains($merchant)) {
  76. $this->merchants->removeElement($merchant);
  77. }
  78. return $this;
  79. }
  80. public function getCode(): ?string
  81. {
  82. return $this->code;
  83. }
  84. public function setCode(?string $code): self
  85. {
  86. $this->code = $code;
  87. return $this;
  88. }
  89. public function getDeliveryPrice(): ?float
  90. {
  91. return $this->deliveryPrice;
  92. }
  93. public function setDeliveryPrice(float $deliveryPrice): self
  94. {
  95. $this->deliveryPrice = $deliveryPrice;
  96. return $this;
  97. }
  98. public function getIsPublic(): ?bool
  99. {
  100. return $this->isPublic;
  101. }
  102. public function setIsPublic(bool $isPublic): self
  103. {
  104. $this->isPublic = $isPublic;
  105. return $this;
  106. }
  107. public function getAddress(): ?AddressInterface
  108. {
  109. return $this->address;
  110. }
  111. public function setAddress(AddressInterface $address): self
  112. {
  113. $this->address = $address;
  114. return $this;
  115. }
  116. /**
  117. * @return Collection|UserPointSaleInterface[]
  118. */
  119. public function getUserPointSales(): Collection
  120. {
  121. return $this->userPointSales;
  122. }
  123. public function addUserPointSale(UserPointSaleInterface $userPointSale): self
  124. {
  125. if (!$this->userPointSales->contains($userPointSale)) {
  126. $this->userPointSales[] = $userPointSale;
  127. $userPointSale->setPointSale($this);
  128. }
  129. return $this;
  130. }
  131. public function removeUserPointSale(UserPointSaleInterface $userPointSale): self
  132. {
  133. if ($this->userPointSales->contains($userPointSale)) {
  134. $this->userPointSales->removeElement($userPointSale);
  135. // set the owning side to null (unless already changed)
  136. if ($userPointSale->getPointSale() === $this) {
  137. $userPointSale->setPointSale(null);
  138. }
  139. }
  140. return $this;
  141. }
  142. public function getImage(): ?File
  143. {
  144. return $this->image;
  145. }
  146. public function setImage(?File $image): self
  147. {
  148. $this->image = $image;
  149. return $this;
  150. }
  151. }