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 UserMetaEntity |
20
|
|
|
*/ |
21
|
|
|
class UserMetaEntity extends AbstractEntity |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var array |
25
|
|
|
*/ |
26
|
|
|
protected $container = [ |
27
|
|
|
'id_user_meta' => null, |
28
|
|
|
'fk_user' => null, |
29
|
|
|
'meta_key' => null, |
30
|
|
|
'meta_data' => null, |
31
|
|
|
'date_created' => null, |
32
|
|
|
'date_modified' => null, |
33
|
|
|
]; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param int $identifier |
37
|
|
|
* @return UserMetaEntity |
38
|
|
|
*/ |
39
|
|
|
public function setUserMetaId(int $identifier) : UserMetaEntity |
40
|
|
|
{ |
41
|
|
|
$this->container['id_user_meta'] = $identifier; |
42
|
|
|
|
43
|
|
|
return $this; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return int|null |
48
|
|
|
*/ |
49
|
|
|
public function getUserMetaId() : ? int |
50
|
|
|
{ |
51
|
|
|
return !is_null($this->container['id_user_meta']) |
52
|
|
|
? (int) $this->container['id_user_meta'] |
53
|
|
|
: null; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param int $userIdentifier |
58
|
|
|
* @return UserMetaEntity |
59
|
|
|
*/ |
60
|
|
|
public function setUserId(int $userIdentifier) : UserMetaEntity |
61
|
|
|
{ |
62
|
|
|
$this->container['fk_user'] = $userIdentifier; |
63
|
|
|
|
64
|
|
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return int|null |
69
|
|
|
*/ |
70
|
|
|
public function getUserId() : ? int |
71
|
|
|
{ |
72
|
|
|
return !is_null($this->container['fk_user']) |
73
|
|
|
? (int) $this->container['fk_user'] |
74
|
|
|
: null; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param string $metaKey |
79
|
|
|
* @return UserMetaEntity |
80
|
|
|
*/ |
81
|
|
|
public function setMetaKey(string $metaKey) : UserMetaEntity |
82
|
|
|
{ |
83
|
|
|
$this->container['meta_key'] = $metaKey; |
84
|
|
|
|
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return null|string |
90
|
|
|
*/ |
91
|
|
|
public function getMetaKey() : ? string |
92
|
|
|
{ |
93
|
|
|
return $this->container['meta_key']; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param string $metaData |
98
|
|
|
* @return UserMetaEntity |
99
|
|
|
*/ |
100
|
|
|
public function setMetaData(string $metaData) : UserMetaEntity |
101
|
|
|
{ |
102
|
|
|
$this->container['meta_data'] = $metaData; |
103
|
|
|
|
104
|
|
|
return $this; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @return null|string |
109
|
|
|
*/ |
110
|
|
|
public function getMetaData() : ? string |
111
|
|
|
{ |
112
|
|
|
return $this->container['meta_data']; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @param DateTime $dateTime |
117
|
|
|
* @return UserMetaEntity |
118
|
|
|
*/ |
119
|
|
|
public function setDateCreated(DateTime $dateTime) : UserMetaEntity |
120
|
|
|
{ |
121
|
|
|
$this->container['date_created'] = $dateTime->format('Y-m-d H:i:s'); |
122
|
|
|
|
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @return null|DateTime |
128
|
|
|
*/ |
129
|
|
|
public function getDateCreated() : ? DateTime |
130
|
|
|
{ |
131
|
|
|
return !empty($this->container['date_created']) |
132
|
|
|
? new DateTime($this->container['date_created']) |
133
|
|
|
: null; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @param DateTime $dateTime |
138
|
|
|
* @return UserMetaEntity |
139
|
|
|
*/ |
140
|
|
|
public function setDateModified(DateTime $dateTime) : UserMetaEntity |
141
|
|
|
{ |
142
|
|
|
$this->container['date_modified'] = $dateTime->format('Y-m-d H:i:s'); |
143
|
|
|
|
144
|
|
|
return $this; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return null|DateTime |
149
|
|
|
*/ |
150
|
|
|
public function getDateModified() : ? DateTime |
151
|
|
|
{ |
152
|
|
|
return !empty($this->container['date_modified']) |
153
|
|
|
? new DateTime($this->container['date_modified']) |
154
|
|
|
: null; |
155
|
|
|
} |
156
|
|
|
} |
157
|
|
|
|