src/Bundles/Messenger/Entity/MessageConfig.php line 11

Open in your IDE?
  1. <?php
  2. namespace Bundles\Messenger\Entity;
  3. use Bundles\Messenger\Repository\MessageConfigRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity(repositoryClass=MessageConfigRepository::class)
  7. */
  8. class MessageConfig {
  9. const SPOT_HIGH = 1;
  10. const SPOT_LOW = 2;
  11. const ARTICLE = 3;
  12. const RATE_ALERTER = 4;
  13. const ARTICLE_NEW_FEATURE = 5;
  14. const TRADE_EXPIRES = 6;
  15. /**
  16. * @ORM\Id()
  17. * @ORM\GeneratedValue()
  18. * @ORM\Column(type="integer")
  19. */
  20. private $id;
  21. /**
  22. * @ORM\Column(type="string", length=255)
  23. */
  24. private $name;
  25. /**
  26. * @ORM\Column(type="smallint")
  27. */
  28. private $type;
  29. /**
  30. * @var array
  31. */
  32. private $types = [];
  33. /**
  34. * @return array
  35. */
  36. public static function getTypes(): array {
  37. $oClass = new \ReflectionClass(__CLASS__);
  38. return $oClass->getConstants();
  39. }
  40. /**
  41. * @param array $types
  42. */
  43. public function setTypes(array $types): void {
  44. $this->types = $types;
  45. }
  46. /**
  47. * @ORM\Column(type="boolean")
  48. */
  49. private $active;
  50. /**
  51. * @ORM\Column(type="boolean", nullable=true)
  52. */
  53. private $sms;
  54. /**
  55. * @ORM\Column(type="boolean", nullable=true)
  56. */
  57. private $mail;
  58. /**
  59. * @ORM\Column(type="string", length=255, nullable=true)
  60. */
  61. private $smsText;
  62. /**
  63. * @ORM\Column(type="text", nullable=true)
  64. */
  65. private $mailText;
  66. /**
  67. * @ORM\Column(type="boolean", nullable=true)
  68. */
  69. private $mailToAdmins;
  70. /**
  71. * @ORM\Column(type="string", length=255, nullable=true)
  72. */
  73. private $attachmentName;
  74. /**
  75. * @ORM\Column(type="text", nullable=true)
  76. */
  77. private $attachmentContent;
  78. /**
  79. * @ORM\Column(type="integer")
  80. */
  81. private $priority;
  82. public function getId(): ?int {
  83. return $this->id;
  84. }
  85. public function getName(): ?string {
  86. return $this->name;
  87. }
  88. public function setName(string $name): self {
  89. $this->name = $name;
  90. return $this;
  91. }
  92. public function getType(): ?int {
  93. return $this->type;
  94. }
  95. public function setType(int $type): self {
  96. $this->type = $type;
  97. return $this;
  98. }
  99. public function getActive(): ?bool {
  100. return $this->active;
  101. }
  102. public function setActive(bool $active): self {
  103. $this->active = $active;
  104. return $this;
  105. }
  106. public function getSms(): ?bool {
  107. return $this->sms;
  108. }
  109. public function setSms(bool $sms): self {
  110. $this->sms = $sms;
  111. return $this;
  112. }
  113. public function getMail(): ?bool {
  114. return $this->mail;
  115. }
  116. public function setMail(bool $mail): self {
  117. $this->mail = $mail;
  118. return $this;
  119. }
  120. public function getSmsText(): ?string {
  121. return $this->smsText;
  122. }
  123. public function setSmsText(string $smsText): self {
  124. $this->smsText = $smsText;
  125. return $this;
  126. }
  127. public function getMailText(): ?string {
  128. return $this->mailText;
  129. }
  130. public function setMailText(string $mailText): self {
  131. $this->mailText = $mailText;
  132. return $this;
  133. }
  134. public function getMailToAdmins(): ?bool {
  135. return $this->mailToAdmins;
  136. }
  137. public function setMailToAdmins(?bool $mailToAdmins): self {
  138. $this->mailToAdmins = $mailToAdmins;
  139. return $this;
  140. }
  141. public function showType() {
  142. $types = self::getTypes();
  143. $types = array_flip($types);
  144. return $types[$this->getType()];
  145. }
  146. public function getAttachmentName(): ?string {
  147. return $this->attachmentName;
  148. }
  149. public function setAttachmentName(?string $attachmentName): self {
  150. $this->attachmentName = $attachmentName;
  151. return $this;
  152. }
  153. public function getAttachmentContent(): ?string {
  154. return $this->attachmentContent;
  155. }
  156. public function setAttachmentContent(?string $attachmentContent): self {
  157. $this->attachmentContent = $attachmentContent;
  158. return $this;
  159. }
  160. public function getPriority(): ?int {
  161. return $this->priority;
  162. }
  163. public function setPriority(int $priority): self {
  164. $this->priority = $priority;
  165. return $this;
  166. }
  167. }