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.

преди 3 години
преди 4 години
преди 3 години
преди 3 години
преди 4 години
преди 4 години
преди 4 години
преди 4 години
преди 3 години
преди 4 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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\FilterMerchantInterface;
  7. use Lc\ShopBundle\Context\ReductionInterface;
  8. use Lc\ShopBundle\Context\ReductionPropertyInterface;
  9. use Lc\ShopBundle\Context\StatusInterface;
  10. /**
  11. * @ORM\MappedSuperclass()
  12. */
  13. abstract class ReductionCredit extends AbstractEntity implements ReductionInterface, FilterMerchantInterface, StatusInterface
  14. {
  15. const TYPE_CREDIT = 'credit';
  16. const TYPE_GIFT = 'gift';
  17. use ReductionTrait;
  18. use StatusTrait;
  19. /**
  20. * @ORM\Column(type="string", length=255)
  21. */
  22. protected $title;
  23. /**
  24. * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="reductionCredits")
  25. */
  26. protected $users;
  27. /**
  28. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
  29. * @ORM\JoinColumn(nullable=false)
  30. */
  31. protected $merchant;
  32. /**
  33. * @ORM\Column(type="string", length=255)
  34. */
  35. protected $type;
  36. /**
  37. * @ORM\Column(type="boolean", nullable=true)
  38. */
  39. protected $sended;
  40. /**
  41. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
  42. */
  43. protected $owner;
  44. public function __construct()
  45. {
  46. $this->users = new ArrayCollection();
  47. $this->unit = 'amount';
  48. }
  49. public function __toString()
  50. {
  51. return $this->title;
  52. }
  53. public function getTitle(): ?string
  54. {
  55. return $this->title;
  56. }
  57. public function setTitle(string $title): self
  58. {
  59. $this->title = $title;
  60. return $this;
  61. }
  62. public function getMerchant(): ?Merchant
  63. {
  64. return $this->merchant;
  65. }
  66. public function setMerchant(?Merchant $merchant): self
  67. {
  68. $this->merchant = $merchant;
  69. return $this;
  70. }
  71. public function getType(): ?string
  72. {
  73. return $this->type;
  74. }
  75. public function setType(string $type): self
  76. {
  77. $this->type = $type;
  78. return $this;
  79. }
  80. /**
  81. * @return Collection|User[]
  82. */
  83. public function getUsers(): Collection
  84. {
  85. return $this->users;
  86. }
  87. public function addUser(User $user): self
  88. {
  89. if (!$this->users->contains($user)) {
  90. $this->users[] = $user;
  91. }
  92. return $this;
  93. }
  94. public function removeUser(User $user): self
  95. {
  96. if ($this->users->contains($user)) {
  97. $this->users->removeElement($user);
  98. }
  99. return $this;
  100. }
  101. public function getSended(): ?bool
  102. {
  103. return $this->sended;
  104. }
  105. public function setSended(?bool $sended): self
  106. {
  107. $this->sended = $sended;
  108. return $this;
  109. }
  110. public function getOwner(): ?User
  111. {
  112. return $this->owner;
  113. }
  114. public function setOwner(?User $owner): self
  115. {
  116. $this->owner = $owner;
  117. return $this;
  118. }
  119. }