Passed
Push — master ( e3b080...c6206b )
by Aimeos
17:44
created

User::getUsername()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * @license MIT, http://opensource.org/licenses/MIT
5
 * @copyright Aimeos (aimeos.org), 2014
6
 */
7
8
9
namespace Aimeos\ShopBundle\Entity;
10
11
use Doctrine\ORM\Mapping as ORM;
12
use Symfony\Component\Security\Core\User\UserInterface;
13
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
14
15
16
/**
17
 * Aimeos\ShopBundle\Entity\User
18
 *
19
 * @ORM\Entity
20
 * @ORM\Table(name="mshop_customer",uniqueConstraints={@ORM\UniqueConstraint(name="unq_mscus_sid_code",columns={"siteid","code"})},indexes={@ORM\Index(name="idx_mscus_sid_langid", columns={"siteid", "langid"}),@ORM\Index(name="idx_mscus_sid_last_first", columns={"siteid", "lastname", "firstname"}),@ORM\Index(name="idx_mscus_sid_post_addr1", columns={"siteid", "postal", "address1"}),@ORM\Index(name="idx_mscus_sid_post_city", columns={"siteid", "postal", "city"}),@ORM\Index(name="idx_mscus_sid_city", columns={"siteid", "city"}),@ORM\Index(name="idx_mscus_sid_email", columns={"siteid", "email"})})
21
 */
22
class User implements UserInterface, PasswordAuthenticatedUserInterface
23
{
24
	/**
25
	 * @ORM\Column(type="integer")
26
	 * @ORM\Id
27
	 * @ORM\GeneratedValue(strategy="AUTO")
28
	 */
29
	protected $id;
30
31
	/**
32
	 * @ORM\Column(name="siteid", type="string", length=255)
33
	 */
34
	protected $siteid;
35
36
	/**
37
	 * @ORM\Column(type="string", length=255)
38
	 */
39
	protected $label;
40
41
	/**
42
	 * @ORM\Column(name="code", type="string", length=255)
43
	 */
44
	protected $username;
45
46
	/**
47
	 * @ORM\Column(name="password", type="string", length=255)
48
	 */
49
	protected $password;
50
51
	/**
52
	 * @ORM\Column(name="status", type="smallint")
53
	 */
54
	protected $isActive;
55
56
	/**
57
	 * @ORM\Column(name="salutation", type="string", length=8)
58
	 */
59
	protected $salutation = '';
60
61
	/**
62
	 * @ORM\Column(name="company", type="string", length=100)
63
	 */
64
	protected $company = '';
65
66
	/**
67
	 * @ORM\Column(name="vatid", type="string", length=32)
68
	 */
69
	protected $vatid = '';
70
71
	/**
72
	 * @ORM\Column(name="title", type="string", length=64)
73
	 */
74
	protected $title = '';
75
76
	/**
77
	 * @ORM\Column(name="firstname", type="string", length=64)
78
	 */
79
	protected $firstname = '';
80
81
	/**
82
	 * @ORM\Column(name="lastname", type="string", length=64)
83
	 */
84
	protected $lastname = '';
85
86
	/**
87
	 * @ORM\Column(name="address1", type="string", length=200)
88
	 */
89
	protected $address1 = '';
90
91
	/**
92
	 * @ORM\Column(name="address2", type="string", length=200)
93
	 */
94
	protected $address2 = '';
95
96
	/**
97
	 * @ORM\Column(name="address3", type="string", length=200)
98
	 */
99
	protected $address3 = '';
100
101
	/**
102
	 * @ORM\Column(name="postal", type="string", length=16)
103
	 */
104
	protected $postal = '';
105
106
	/**
107
	 * @ORM\Column(name="city", type="string", length=200)
108
	 */
109
	protected $city = '';
110
111
	/**
112
	 * @ORM\Column(name="state", type="string", length=200)
113
	 */
114
	protected $state = '';
115
116
	/**
117
	 * @ORM\Column(name="langid", type="string", length=5, nullable=true)
118
	 */
119
	protected $langid = '';
120
121
	/**
122
	 * @ORM\Column(name="countryid", type="string", length=2, nullable=true, options={"fixed" = true})
123
	 */
124
	protected $countryid = '';
125
126
	/**
127
	 * @ORM\Column(name="telephone", type="string", length=32)
128
	 */
129
	protected $telephone = '';
130
131
	/**
132
	 * @ORM\Column(name="telefax", type="string", length=32)
133
	 */
134
	protected $telefax = '';
135
136
	/**
137
	 * @ORM\Column(name="email", type="string", length=255)
138
	 */
139
	protected $email = '';
140
141
	/**
142
	 * @ORM\Column(name="website", type="string", length=255)
143
	 */
144
	protected $website = '';
145
146
	/**
147
	 * @ORM\Column(name="longitude", type="decimal", precision=8, scale=6, nullable=true)
148
	 */
149
	protected $longitude;
150
151
	/**
152
	 * @ORM\Column(name="latitude", type="decimal", precision=8, scale=6, nullable=true)
153
	 */
154
	protected $latitude;
155
156
	/**
157
	 * @ORM\Column(name="birthday", type="date", nullable=true)
158
	 */
159
	protected $birthday;
160
161
	/**
162
	 * @ORM\Column(name="vdate", type="date", nullable=true)
163
	 */
164
	protected $vdate;
165
166
	/**
167
	 * @ORM\Column(name="ctime", type="datetime")
168
	 */
169
	protected $ctime;
170
171
	/**
172
	 * @ORM\Column(name="mtime", type="datetime")
173
	 */
174
	protected $mtime;
175
176
	/**
177
	 * @ORM\Column(name="editor", type="string", length=255)
178
	 */
179
	protected $editor = '';
180
181
182
	public function getUserIdentifier() : string
183
	{
184
		return $this->id ?? '';
185
	}
186
187
188
	/**
189
	 * @inheritDoc
190
	 */
191
	public function getId() : ?string
192
	{
193
		return $this->id;
194
	}
195
196
197
	/**
198
	 * @inheritDoc
199
	 */
200
	public function getUsername() : ?string
201
	{
202
		return $this->username;
203
	}
204
205
206
	/**
207
	 * @inheritDoc
208
	 */
209
	public function getPassword() : ?string
210
	{
211
		return $this->password;
212
	}
213
214
215
	/**
216
	 * @inheritDoc
217
	 */
218
	public function getRoles() : array
219
	{
220
		return array( 'ROLE_USER' );
221
	}
222
223
224
	/**
225
	 * @inheritDoc
226
	 */
227
	public function eraseCredentials()
228
	{
229
	}
230
231
232
	public function __serialize() : array
233
	{
234
		return array(
235
			'id' => $this->id,
236
			'username' => $this->username,
237
			'password' => $this->password,
238
		) + parent::__serialize();
239
	}
240
241
242
	public function __unserialize( array $data ) : void
243
	{
244
		$this->id = $data['id'] ?? null;
245
		$this->username = $data['username'] ?? null;
246
		$this->password = $data['password'] ?? null;
247
248
		parent::__unserialize( $data );
249
	}
250
}