zend-blog-3-backend
96 строк · 1.8 Кб
1<?php
2
3namespace App\Entity;
4
5use App\Entity\Traits\ModifyEntityTrait;
6use Doctrine\ORM\Mapping as ORM;
7
8/**
9* @ORM\Table(name="subscription_settings", uniqueConstraints={
10* @ORM\UniqueConstraint(columns={"email", "subs_type"})
11* })
12* @ORM\Entity(repositoryClass="App\Repository\EmailSubscriptionSettingsRepository")
13* @ORM\HasLifecycleCallbacks()
14*/
15class EmailSubscriptionSettings
16{
17use ModifyEntityTrait;
18
19public const TYPE_COMMENT_REPLY = 1;
20
21/**
22* @var int
23*
24* @ORM\Id
25* @ORM\Column(type="integer")
26* @ORM\GeneratedValue(strategy="AUTO")
27*/
28private $id;
29
30/**
31* @var string
32*
33* @ORM\Column(type="string", length=64)
34*/
35private $email;
36
37/**
38* @var bool
39*
40* @ORM\Column(type="boolean", options={"default": false})
41*/
42private $blockSending = false;
43
44/**
45* @var int
46*
47* @ORM\Column(type="smallint", name="subs_type", options={"default": 1, "comment":"1: reply"})
48*/
49private $type = self::TYPE_COMMENT_REPLY;
50
51public function __construct()
52{
53$this->timeCreated = new \DateTime();
54}
55
56public function getId()
57{
58return $this->id;
59}
60
61public function getEmail()
62{
63return $this->email;
64}
65
66public function setEmail(string $email): self
67{
68$this->email = $email;
69
70return $this;
71}
72
73public function isBlockSending(): bool
74{
75return $this->blockSending;
76}
77
78public function setBlockSending(bool $block): self
79{
80$this->blockSending = $block;
81
82return $this;
83}
84
85public function getType(): int
86{
87return $this->type;
88}
89
90public function setType(int $type): self
91{
92$this->type = $type;
93
94return $this;
95}
96}
97