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.

212 Zeilen
4.5KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Model\Reduction;
  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\FilterMerchantInterface;
  7. use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
  8. use Lc\CaracoleBundle\Doctrine\Extension\ReductionInterface;
  9. use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
  10. use Lc\CaracoleBundle\Model\Config\UnitModel;
  11. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  12. use Lc\CaracoleBundle\Model\Section\SectionInterface;
  13. use Lc\SovBundle\Doctrine\Extension\StatusInterface;
  14. use Lc\SovBundle\Doctrine\Extension\StatusTrait;
  15. use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
  16. use Lc\SovBundle\Model\User\UserInterface;
  17. /**
  18. * @ORM\MappedSuperclass()
  19. */
  20. abstract class ReductionCreditModel extends AbstractLightEntity implements ReductionInterface, FilterSectionInterface,
  21. StatusInterface
  22. {
  23. const TYPE_CREDIT = 'credit';
  24. const TYPE_GIFT = 'gift';
  25. use ReductionTrait;
  26. use StatusTrait;
  27. /**
  28. * @ORM\Column(type="string", length=255)
  29. */
  30. protected $title;
  31. /**
  32. * @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="reductionCredits")
  33. */
  34. protected $users;
  35. /**
  36. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface")
  37. * @ORM\JoinColumn(nullable=false)
  38. */
  39. protected $section;
  40. /**
  41. * @ORM\Column(type="string", length=255)
  42. */
  43. protected $type;
  44. /**
  45. * @ORM\Column(type="boolean", nullable=true)
  46. */
  47. protected $sended;
  48. /**
  49. * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
  50. */
  51. protected $owner;
  52. /**
  53. * @ORM\Column(type="datetime", nullable=true)
  54. */
  55. protected $activationDate;
  56. /**
  57. * @ORM\Column(type="string", length=255, nullable=true)
  58. */
  59. protected $ownerName;
  60. /**
  61. * @ORM\Column(type="text", nullable=true)
  62. */
  63. protected $ownerMessage;
  64. public function __construct()
  65. {
  66. $this->users = new ArrayCollection();
  67. $this->unit = UnitModel::UNIT_AMOUNT;
  68. }
  69. public function __toString()
  70. {
  71. return $this->title;
  72. }
  73. public function getTitle(): ?string
  74. {
  75. return $this->title;
  76. }
  77. public function setTitle(string $title): self
  78. {
  79. $this->title = $title;
  80. return $this;
  81. }
  82. public function getSection(): SectionInterface
  83. {
  84. return $this->section;
  85. }
  86. public function setSection(SectionInterface $section): self
  87. {
  88. $this->section = $section;
  89. return $this;
  90. }
  91. public function getType(): ?string
  92. {
  93. return $this->type;
  94. }
  95. public function setType(string $type): self
  96. {
  97. $this->type = $type;
  98. return $this;
  99. }
  100. /**
  101. * @return Collection|UserInterface[]
  102. */
  103. public function getUsers(): Collection
  104. {
  105. return $this->users;
  106. }
  107. public function addUser(UserInterface $user): self
  108. {
  109. if (!$this->users->contains($user)) {
  110. $this->users[] = $user;
  111. }
  112. return $this;
  113. }
  114. public function removeUser(UserInterface $user): self
  115. {
  116. if ($this->users->contains($user)) {
  117. $this->users->removeElement($user);
  118. }
  119. return $this;
  120. }
  121. public function getSended(): ?bool
  122. {
  123. return $this->sended;
  124. }
  125. public function setSended(?bool $sended): self
  126. {
  127. $this->sended = $sended;
  128. return $this;
  129. }
  130. public function getOwner(): ?UserInterface
  131. {
  132. return $this->owner;
  133. }
  134. public function setOwner(?UserInterface $owner): self
  135. {
  136. $this->owner = $owner;
  137. return $this;
  138. }
  139. public function getActivationDate(): ?\DateTimeInterface
  140. {
  141. return $this->activationDate;
  142. }
  143. public function setActivationDate(?\DateTimeInterface $activationDate): self
  144. {
  145. $this->activationDate = $activationDate;
  146. return $this;
  147. }
  148. public function getOwnerName(): ?string
  149. {
  150. return $this->ownerName;
  151. }
  152. public function setOwnerName(?string $ownerName): self
  153. {
  154. $this->ownerName = $ownerName;
  155. return $this;
  156. }
  157. public function getOwnerMessage(): ?string
  158. {
  159. return $this->ownerMessage;
  160. }
  161. public function setOwnerMessage(?string $ownerMessage): self
  162. {
  163. $this->ownerMessage = $ownerMessage;
  164. return $this;
  165. }
  166. }