1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* WebHemi. |
4
|
|
|
* |
5
|
|
|
* PHP version 7.1 |
6
|
|
|
* |
7
|
|
|
* @copyright 2012 - 2018 Gixx-web (http://www.gixx-web.com) |
8
|
|
|
* @license https://opensource.org/licenses/MIT The MIT License (MIT) |
9
|
|
|
* |
10
|
|
|
* @link http://www.gixx-web.com |
11
|
|
|
*/ |
12
|
|
|
declare(strict_types = 1); |
13
|
|
|
|
14
|
|
|
namespace WebHemi\Data\Entity; |
15
|
|
|
|
16
|
|
|
use WebHemi\DateTime; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class UserGroupEntity |
20
|
|
|
*/ |
21
|
|
|
class UserGroupEntity extends AbstractEntity |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var array |
25
|
|
|
*/ |
26
|
|
|
protected $container = [ |
27
|
|
|
'id_user_group' => null, |
28
|
|
|
'name' => null, |
29
|
|
|
'title' => null, |
30
|
|
|
'description' => null, |
31
|
|
|
'is_read_only' => null, |
32
|
|
|
'date_created' => null, |
33
|
|
|
'date_modified' => null, |
34
|
|
|
]; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param int $identifier |
38
|
|
|
* @return UserGroupEntity |
39
|
|
|
*/ |
40
|
|
|
public function setUserGroupId(int $identifier) : UserGroupEntity |
41
|
|
|
{ |
42
|
|
|
$this->container['id_user_group'] = $identifier; |
43
|
|
|
|
44
|
|
|
return $this; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return int|null |
49
|
|
|
*/ |
50
|
1 |
|
public function getUserGroupId() : ? int |
51
|
|
|
{ |
52
|
1 |
|
return !is_null($this->container['id_user_group']) |
53
|
1 |
|
? (int) $this->container['id_user_group'] |
54
|
1 |
|
: null; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param string $name |
59
|
|
|
* @return UserGroupEntity |
60
|
|
|
*/ |
61
|
|
|
public function setName(string $name) : UserGroupEntity |
62
|
|
|
{ |
63
|
|
|
$this->container['name'] = $name; |
64
|
|
|
|
65
|
|
|
return $this; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return null|string |
70
|
|
|
*/ |
71
|
|
|
public function getName() : ? string |
72
|
|
|
{ |
73
|
|
|
return $this->container['name']; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param string $title |
78
|
|
|
* @return UserGroupEntity |
79
|
|
|
*/ |
80
|
|
|
public function setTitle(string $title) : UserGroupEntity |
81
|
|
|
{ |
82
|
|
|
$this->container['title'] = $title; |
83
|
|
|
|
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return null|string |
89
|
|
|
*/ |
90
|
|
|
public function getTitle() : ? string |
91
|
|
|
{ |
92
|
|
|
return $this->container['title']; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param string $description |
97
|
|
|
* @return UserGroupEntity |
98
|
|
|
*/ |
99
|
|
|
public function setDescription(string $description) : UserGroupEntity |
100
|
|
|
{ |
101
|
|
|
$this->container['description'] = $description; |
102
|
|
|
|
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return null|string |
108
|
|
|
*/ |
109
|
|
|
public function getDescription() : ? string |
110
|
|
|
{ |
111
|
|
|
return $this->container['description']; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param bool $isReadonly |
116
|
|
|
* @return UserGroupEntity |
117
|
|
|
*/ |
118
|
|
|
public function setIsReadOnly(bool $isReadonly) : UserGroupEntity |
119
|
|
|
{ |
120
|
|
|
$this->container['is_read_only'] = $isReadonly ? 1 : 0; |
121
|
|
|
|
122
|
|
|
return $this; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @return bool |
127
|
|
|
*/ |
128
|
|
|
public function getIsReadOnly() : bool |
129
|
|
|
{ |
130
|
|
|
return !empty($this->container['is_read_only']); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @param DateTime $dateTime |
135
|
|
|
* @return UserGroupEntity |
136
|
|
|
*/ |
137
|
|
|
public function setDateCreated(DateTime $dateTime) : UserGroupEntity |
138
|
|
|
{ |
139
|
|
|
$this->container['date_created'] = $dateTime->format('Y-m-d H:i:s'); |
140
|
|
|
|
141
|
|
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @return null|DateTime |
146
|
|
|
*/ |
147
|
|
|
public function getDateCreated() : ? DateTime |
148
|
|
|
{ |
149
|
|
|
return !empty($this->container['date_created']) |
150
|
|
|
? new DateTime($this->container['date_created']) |
151
|
|
|
: null; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @param DateTime $dateTime |
156
|
|
|
* @return UserGroupEntity |
157
|
|
|
*/ |
158
|
|
|
public function setDateModified(DateTime $dateTime) : UserGroupEntity |
159
|
|
|
{ |
160
|
|
|
$this->container['date_modified'] = $dateTime->format('Y-m-d H:i:s'); |
161
|
|
|
|
162
|
|
|
return $this; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @return null|DateTime |
167
|
|
|
*/ |
168
|
|
|
public function getDateModified() : ? DateTime |
169
|
|
|
{ |
170
|
|
|
return !empty($this->container['date_modified']) |
171
|
|
|
? new DateTime($this->container['date_modified']) |
172
|
|
|
: null; |
173
|
|
|
} |
174
|
|
|
} |
175
|
|
|
|