<?php
namespace Bundles\Messenger\Entity;
use Bundles\Messenger\Repository\MessageConfigRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=MessageConfigRepository::class)
*/
class MessageConfig {
const SPOT_HIGH = 1;
const SPOT_LOW = 2;
const ARTICLE = 3;
const RATE_ALERTER = 4;
const ARTICLE_NEW_FEATURE = 5;
const TRADE_EXPIRES = 6;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="smallint")
*/
private $type;
/**
* @var array
*/
private $types = [];
/**
* @return array
*/
public static function getTypes(): array {
$oClass = new \ReflectionClass(__CLASS__);
return $oClass->getConstants();
}
/**
* @param array $types
*/
public function setTypes(array $types): void {
$this->types = $types;
}
/**
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $sms;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $mail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $smsText;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $mailText;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $mailToAdmins;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $attachmentName;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $attachmentContent;
/**
* @ORM\Column(type="integer")
*/
private $priority;
public function getId(): ?int {
return $this->id;
}
public function getName(): ?string {
return $this->name;
}
public function setName(string $name): self {
$this->name = $name;
return $this;
}
public function getType(): ?int {
return $this->type;
}
public function setType(int $type): self {
$this->type = $type;
return $this;
}
public function getActive(): ?bool {
return $this->active;
}
public function setActive(bool $active): self {
$this->active = $active;
return $this;
}
public function getSms(): ?bool {
return $this->sms;
}
public function setSms(bool $sms): self {
$this->sms = $sms;
return $this;
}
public function getMail(): ?bool {
return $this->mail;
}
public function setMail(bool $mail): self {
$this->mail = $mail;
return $this;
}
public function getSmsText(): ?string {
return $this->smsText;
}
public function setSmsText(string $smsText): self {
$this->smsText = $smsText;
return $this;
}
public function getMailText(): ?string {
return $this->mailText;
}
public function setMailText(string $mailText): self {
$this->mailText = $mailText;
return $this;
}
public function getMailToAdmins(): ?bool {
return $this->mailToAdmins;
}
public function setMailToAdmins(?bool $mailToAdmins): self {
$this->mailToAdmins = $mailToAdmins;
return $this;
}
public function showType() {
$types = self::getTypes();
$types = array_flip($types);
return $types[$this->getType()];
}
public function getAttachmentName(): ?string {
return $this->attachmentName;
}
public function setAttachmentName(?string $attachmentName): self {
$this->attachmentName = $attachmentName;
return $this;
}
public function getAttachmentContent(): ?string {
return $this->attachmentContent;
}
public function setAttachmentContent(?string $attachmentContent): self {
$this->attachmentContent = $attachmentContent;
return $this;
}
public function getPriority(): ?int {
return $this->priority;
}
public function setPriority(int $priority): self {
$this->priority = $priority;
return $this;
}
}