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.

182 Zeilen
5.1KB

  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 FOS\UserBundle\Model\User as UserModelFOS;
  7. use Lc\ShopBundle\Context\MerchantInterface;
  8. /**
  9. * @ORM\MappedSuperclass()
  10. */
  11. abstract class User extends UserModelFOS
  12. {
  13. /**
  14. * @ORM\Column(type="string", length=20, nullable=true)
  15. */
  16. protected $phone;
  17. /**
  18. * @ORM\Column(type="string", length=64, nullable=true)
  19. */
  20. protected $behaviorDisplayPrice;
  21. /**
  22. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
  23. */
  24. protected $merchant;
  25. /**
  26. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\CreditHistoryInterface", mappedBy="user", orphanRemoval=true)
  27. */
  28. private $creditHistories;
  29. /**
  30. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\AddressInterface", mappedBy="user")
  31. */
  32. private $addresses;
  33. /**
  34. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="user")
  35. */
  36. private $orders;
  37. public function __construct()
  38. {
  39. $this->creditHistories = new ArrayCollection();
  40. $this->addresses = new ArrayCollection();
  41. $this->orders = new ArrayCollection();
  42. }
  43. public function getPhone(): ?string
  44. {
  45. return $this->phone;
  46. }
  47. public function setPhone(?string $phone): self
  48. {
  49. $this->phone = $phone;
  50. return $this;
  51. }
  52. public function getBehaviorDisplayPrice(): ?string
  53. {
  54. return $this->behaviorDisplayPrice;
  55. }
  56. public function setBehaviorDisplayPrice(?string $behaviorDisplayPrice): self
  57. {
  58. $this->behaviorDisplayPrice = $behaviorDisplayPrice;
  59. return $this;
  60. }
  61. public function getMerchant(): ?MerchantInterface
  62. {
  63. return $this->merchant;
  64. }
  65. public function setMerchant(?MerchantInterface $merchant): self
  66. {
  67. $this->merchant = $merchant;
  68. return $this;
  69. }
  70. /**
  71. * @return Collection|CreditHistory[]
  72. */
  73. public function getCreditHistories(): Collection
  74. {
  75. return $this->creditHistories;
  76. }
  77. public function addCreditHistory(CreditHistory $creditHistory): self
  78. {
  79. if (!$this->creditHistories->contains($creditHistory)) {
  80. $this->creditHistories[] = $creditHistory;
  81. $creditHistory->setUser($this);
  82. }
  83. return $this;
  84. }
  85. public function removeCreditHistory(CreditHistory $creditHistory): self
  86. {
  87. if ($this->creditHistories->contains($creditHistory)) {
  88. $this->creditHistories->removeElement($creditHistory);
  89. // set the owning side to null (unless already changed)
  90. if ($creditHistory->getUser() === $this) {
  91. $creditHistory->setUser(null);
  92. }
  93. }
  94. return $this;
  95. }
  96. /**
  97. * @return Collection|Address[]
  98. */
  99. public function getAddresses(): Collection
  100. {
  101. return $this->addresses;
  102. }
  103. public function addAddress(Address $address): self
  104. {
  105. if (!$this->addresses->contains($address)) {
  106. $this->addresses[] = $address;
  107. $address->setUser($this);
  108. }
  109. return $this;
  110. }
  111. public function removeAddress(Address $address): self
  112. {
  113. if ($this->addresses->contains($address)) {
  114. $this->addresses->removeElement($address);
  115. // set the owning side to null (unless already changed)
  116. if ($address->getUser() === $this) {
  117. $address->setUser(null);
  118. }
  119. }
  120. return $this;
  121. }
  122. /**
  123. * @return Collection|ShopOrder[]
  124. */
  125. public function getOrders(): Collection
  126. {
  127. return $this->orders;
  128. }
  129. public function addOrder(OrderShop $order): self
  130. {
  131. if (!$this->orders->contains($order)) {
  132. $this->orders[] = $order;
  133. $order->setUser($this);
  134. }
  135. return $this;
  136. }
  137. public function removeOrder(OrderShop $order): self
  138. {
  139. if ($this->orders->contains($order)) {
  140. $this->orders->removeElement($order);
  141. // set the owning side to null (unless already changed)
  142. if ($order->getUser() === $this) {
  143. $order->setUser(null);
  144. }
  145. }
  146. return $this;
  147. }
  148. }