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.

pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <?php
  2. namespace Lc\CaracoleBundle\Model\User;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Lc\CaracoleBundle\Model\Address\AddressInterface;
  8. use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;
  9. use Lc\SovBundle\Model\Newsletter\NewsletterInterface;
  10. use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
  11. use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
  12. use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface;
  13. use Lc\SovBundle\Model\User\UserModel as SovUserModel;
  14. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  15. use Lc\SovBundle\Model\Ticket\TicketInterface;
  16. /**
  17. * @ORM\MappedSuperclass()
  18. *
  19. */
  20. abstract class UserModel extends SovUserModel
  21. {
  22. /**
  23. * @ORM\Column(type="string", length=64, nullable=true)
  24. */
  25. protected $behaviorDisplayPrice;
  26. /**
  27. * @ORM\Column(type="boolean", nullable=true)
  28. */
  29. protected $isSaleAlwaysOpen;
  30. /**
  31. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface")
  32. */
  33. protected $favoriteMerchant;
  34. /**
  35. * @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface", mappedBy="user", cascade={"persist"})
  36. */
  37. protected $addresses;
  38. /**
  39. * @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Order\OrderShopInterface", mappedBy="user")
  40. */
  41. protected $orderShops;
  42. /**
  43. * @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface", inversedBy="users")
  44. */
  45. protected $newsletters;
  46. /**
  47. * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductFamilyInterface")
  48. */
  49. protected $favoriteProductFamilies;
  50. /**
  51. * @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserPointSaleInterface", mappedBy="user", orphanRemoval=true)
  52. */
  53. protected $userPointSales;
  54. /**
  55. * @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\User\UserMerchantInterface", mappedBy="user", orphanRemoval=true)
  56. */
  57. protected $userMerchants;
  58. /**
  59. * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface", mappedBy="users")
  60. */
  61. protected $reductionCredits;
  62. public function __construct()
  63. {
  64. parent::__construct();
  65. $this->addresses = new ArrayCollection();
  66. $this->orderShops = new ArrayCollection();
  67. $this->groupUsers = new ArrayCollection();
  68. $this->newsletters = new ArrayCollection();
  69. $this->favoriteProductFamilies = new ArrayCollection();
  70. $this->userPointSales = new ArrayCollection();
  71. $this->userMerchants = new ArrayCollection();
  72. $this->reductionCredits = new ArrayCollection();
  73. }
  74. public function getBehaviorDisplayPrice(): ?string
  75. {
  76. return $this->behaviorDisplayPrice;
  77. }
  78. public function setBehaviorDisplayPrice(?string $behaviorDisplayPrice): self
  79. {
  80. $this->behaviorDisplayPrice = $behaviorDisplayPrice;
  81. return $this;
  82. }
  83. public function getIsSaleAlwaysOpen(): ?bool
  84. {
  85. return $this->isSaleAlwaysOpen;
  86. }
  87. public function setIsSaleAlwaysOpen(?bool $isSaleAlwaysOpen): self
  88. {
  89. $this->isSaleAlwaysOpen = $isSaleAlwaysOpen;
  90. return $this;
  91. }
  92. public function getFavoriteMerchant(): ?MerchantInterface
  93. {
  94. return $this->favoriteMerchant;
  95. }
  96. public function setFavoriteMerchant(?MerchantInterface $merchant): self
  97. {
  98. $this->favoriteMerchant = $merchant;
  99. return $this;
  100. }
  101. /**
  102. * @return Collection|AddressInterface[]
  103. */
  104. public function getAddresses($status = null): Collection
  105. {
  106. if ($status) {
  107. $addressToReturn = new ArrayCollection();
  108. foreach ($this->addresses as $address) {
  109. if ($address->getStatus() == $status) {
  110. $addressToReturn[] = $address;
  111. }
  112. }
  113. return $addressToReturn;
  114. } else {
  115. return $this->addresses;
  116. }
  117. }
  118. public function addAddress(AddressInterface $address): self
  119. {
  120. if (!$this->addresses->contains($address)) {
  121. $this->addresses[] = $address;
  122. $address->setUser($this);
  123. }
  124. return $this;
  125. }
  126. public function removeAddress(AddressInterface $address): self
  127. {
  128. if ($this->addresses->contains($address)) {
  129. $this->addresses->removeElement($address);
  130. // set the owning side to null (unless already changed)
  131. if ($address->getUser() === $this) {
  132. $address->setUser(null);
  133. }
  134. }
  135. return $this;
  136. }
  137. /**
  138. * @return Collection|OrderShopInterface[]
  139. */
  140. public function getOrderShops(): Collection
  141. {
  142. return $this->orderShops;
  143. }
  144. public function addOrderShop(OrderShopInterface $orderShop): self
  145. {
  146. if (!$this->orderShops->contains($orderShop)) {
  147. $this->orderShops[] = $orderShop;
  148. $orderShop->setUser($this);
  149. }
  150. return $this;
  151. }
  152. public function removeOrderShop(OrderShopInterface $orderShop): self
  153. {
  154. if ($this->orderShops->contains($orderShop)) {
  155. $this->orderShops->removeElement($orderShop);
  156. // set the owning side to null (unless already changed)
  157. if ($orderShop->getUser() === $this) {
  158. $orderShop->setUser(null);
  159. }
  160. }
  161. return $this;
  162. }
  163. /**
  164. * @return Collection|NewsletterInterface[]
  165. */
  166. public function getNewsletters(): Collection
  167. {
  168. return $this->newsletters;
  169. }
  170. public function addNewsletter(NewsletterInterface $newsletter): self
  171. {
  172. if (!$this->newsletters->contains($newsletter)) {
  173. $this->newsletters[] = $newsletter;
  174. }
  175. return $this;
  176. }
  177. public function removeNewsletter(NewsletterInterface $newsletter): self
  178. {
  179. if ($this->newsletters->contains($newsletter)) {
  180. $this->newsletters->removeElement($newsletter);
  181. }
  182. return $this;
  183. }
  184. /**
  185. * @return Collection|ProductFamilyInterface[]
  186. */
  187. public function getFavoriteProductFamilies(): Collection
  188. {
  189. return $this->favoriteProductFamilies;
  190. }
  191. public function addFavoriteProductFamily(ProductFamilyInterface $favoriteProductFamily): self
  192. {
  193. if (!$this->favoriteProductFamilies->contains($favoriteProductFamily)) {
  194. $this->favoriteProductFamilies[] = $favoriteProductFamily;
  195. }
  196. return $this;
  197. }
  198. public function removeFavoriteProductFamily(ProductFamilyInterface $favoriteProductFamily): self
  199. {
  200. if ($this->favoriteProductFamilies->contains($favoriteProductFamily)) {
  201. $this->favoriteProductFamilies->removeElement($favoriteProductFamily);
  202. }
  203. return $this;
  204. }
  205. /**
  206. * @return Collection|UserPointSaleInterface[]
  207. */
  208. public function getUserPointSales(): Collection
  209. {
  210. return $this->userPointSales;
  211. }
  212. public function addUserPointSale(UserPointSaleInterface $userPointSale): self
  213. {
  214. if (!$this->userPointSales->contains($userPointSale)) {
  215. $this->userPointSales[] = $userPointSale;
  216. $userPointSale->setUser($this);
  217. }
  218. return $this;
  219. }
  220. public function removeUserPointSale(UserPointSaleInterface $userPointSale): self
  221. {
  222. if ($this->userPointSales->contains($userPointSale)) {
  223. $this->userPointSales->removeElement($userPointSale);
  224. // set the owning side to null (unless already changed)
  225. if ($userPointSale->getUser() === $this) {
  226. $userPointSale->setUser(null);
  227. }
  228. }
  229. return $this;
  230. }
  231. /**
  232. * @return Collection|ReductionCreditInterface[]
  233. */
  234. public function getReductionCredits(): Collection
  235. {
  236. return $this->reductionCredits;
  237. }
  238. public function addReductionCredit(ReductionCreditInterface $reductionCredit): self
  239. {
  240. if (!$this->reductionCredits->contains($reductionCredit)) {
  241. $this->reductionCredits[] = $reductionCredit;
  242. $reductionCredit->addUser($this);
  243. }
  244. return $this;
  245. }
  246. public function removeReductionCredit(ReductionCreditInterface $reductionCredit): self
  247. {
  248. if ($this->reductionCredits->contains($reductionCredit)) {
  249. $this->reductionCredits->removeElement($reductionCredit);
  250. $reductionCredit->removeUser($this);
  251. }
  252. return $this;
  253. }
  254. }