選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ReductionCredit.php 3.4KB

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")
  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. /**
  72. * @return Collection|User[]
  73. */
  74. public function getUsers(): Collection
  75. {
  76. return $this->users;
  77. }
  78. public function addUser(User $user): self
  79. {
  80. if (!$this->users->contains($user)) {
  81. $this->users[] = $user;
  82. }
  83. return $this;
  84. }
  85. public function removeUser(User $user): self
  86. {
  87. if ($this->users->contains($user)) {
  88. $this->users->removeElement($user);
  89. }
  90. return $this;
  91. }
  92. public function getType(): ?string
  93. {
  94. return $this->type;
  95. }
  96. public function setType(string $type): self
  97. {
  98. $this->type = $type;
  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. }