|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the Superdesk Web Publisher MultiTenancy Component. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright 2015 Sourcefabric z.u. and contributors. |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please see the |
|
9
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
|
10
|
|
|
* |
|
11
|
|
|
* @copyright 2015 Sourcefabric z.ú. |
|
12
|
|
|
* @license http://www.superdesk.org/license |
|
13
|
|
|
*/ |
|
14
|
|
|
namespace SWP\Component\MultiTenancy\Model; |
|
15
|
|
|
|
|
16
|
|
|
class Tenant implements TenantInterface |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var mixed |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $id; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var string |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $subdomain; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $name; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var bool |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $enabled = true; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var \DateTime |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $createdAt; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var \DateTime |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $updatedAt = null; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var \DateTime |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $deletedAt = null; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Tenant constructor. |
|
55
|
|
|
*/ |
|
56
|
|
|
public function __construct() |
|
57
|
|
|
{ |
|
58
|
|
|
$this->createdAt = new \DateTime(); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* {@inheritdoc} |
|
63
|
|
|
*/ |
|
64
|
|
|
public function getId() |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->id; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* {@inheritdoc} |
|
71
|
|
|
*/ |
|
72
|
|
|
public function setId($id) |
|
73
|
|
|
{ |
|
74
|
|
|
$this->id = $id; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* {@inheritdoc} |
|
79
|
|
|
*/ |
|
80
|
|
|
public function getSubdomain() |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->subdomain; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* {@inheritdoc} |
|
87
|
|
|
*/ |
|
88
|
|
|
public function setSubdomain($subdomain) |
|
89
|
|
|
{ |
|
90
|
|
|
$this->subdomain = $subdomain; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* {@inheritdoc} |
|
95
|
|
|
*/ |
|
96
|
|
|
public function getName() |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->name; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* {@inheritdoc} |
|
103
|
|
|
*/ |
|
104
|
|
|
public function setName($name) |
|
105
|
|
|
{ |
|
106
|
|
|
$this->name = $name; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* {@inheritdoc} |
|
111
|
|
|
*/ |
|
112
|
|
|
public function isEnabled() |
|
113
|
|
|
{ |
|
114
|
|
|
return $this->enabled; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* {@inheritdoc} |
|
119
|
|
|
*/ |
|
120
|
|
|
public function setEnabled($enabled) |
|
121
|
|
|
{ |
|
122
|
|
|
$this->enabled = $enabled; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* {@inheritdoc} |
|
127
|
|
|
*/ |
|
128
|
|
|
public function getCreatedAt() |
|
129
|
|
|
{ |
|
130
|
|
|
return $this->createdAt; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* {@inheritdoc} |
|
135
|
|
|
*/ |
|
136
|
|
|
public function setCreatedAt(\DateTime $createdAt) |
|
137
|
|
|
{ |
|
138
|
|
|
$this->createdAt = $createdAt; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* {@inheritdoc} |
|
143
|
|
|
*/ |
|
144
|
|
|
public function getUpdatedAt() |
|
145
|
|
|
{ |
|
146
|
|
|
return $this->updatedAt; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* {@inheritdoc} |
|
151
|
|
|
*/ |
|
152
|
|
|
public function setUpdatedAt(\DateTime $updatedAt) |
|
153
|
|
|
{ |
|
154
|
|
|
$this->updatedAt = $updatedAt; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* {@inheritdoc} |
|
159
|
|
|
*/ |
|
160
|
|
|
public function getDeletedAt() |
|
161
|
|
|
{ |
|
162
|
|
|
return $this->deletedAt; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* {@inheritdoc} |
|
167
|
|
|
*/ |
|
168
|
|
|
public function setDeletedAt(\DateTime $deletedAt = null) |
|
169
|
|
|
{ |
|
170
|
|
|
$this->deletedAt = $deletedAt; |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* {@inheritdoc} |
|
175
|
|
|
*/ |
|
176
|
|
|
public function isDeleted() |
|
177
|
|
|
{ |
|
178
|
|
|
return null !== $this->deletedAt; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @return string |
|
183
|
|
|
*/ |
|
184
|
|
|
public function __toString() |
|
185
|
|
|
{ |
|
186
|
|
|
return (string) $this->subdomain; |
|
187
|
|
|
} |
|
188
|
|
|
} |
|
189
|
|
|
|