1<?php
2
3/*
4 * This file is part of the TYPO3 CMS project.
5 *
6 * It is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License, either version 2
8 * of the License, or any later version.
9 *
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
12 *
13 * The TYPO3 project - inspiring people to share!
14 */
15
16namespace TYPO3\CMS\Extbase\Domain\Model;
17
18use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
19use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
20
21/**
22 * A Frontend User
23 */
24class FrontendUser extends AbstractEntity
25{
26    /**
27     * @var string
28     */
29    protected $username = '';
30
31    /**
32     * @var string
33     */
34    protected $password = '';
35
36    /**
37     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup>
38     */
39    protected $usergroup;
40
41    /**
42     * @var string
43     */
44    protected $name = '';
45
46    /**
47     * @var string
48     */
49    protected $firstName = '';
50
51    /**
52     * @var string
53     */
54    protected $middleName = '';
55
56    /**
57     * @var string
58     */
59    protected $lastName = '';
60
61    /**
62     * @var string
63     */
64    protected $address = '';
65
66    /**
67     * @var string
68     */
69    protected $telephone = '';
70
71    /**
72     * @var string
73     */
74    protected $fax = '';
75
76    /**
77     * @var string
78     */
79    protected $email = '';
80
81    /**
82     * @var string
83     */
84    protected $lockToDomain = '';
85
86    /**
87     * @var string
88     */
89    protected $title = '';
90
91    /**
92     * @var string
93     */
94    protected $zip = '';
95
96    /**
97     * @var string
98     */
99    protected $city = '';
100
101    /**
102     * @var string
103     */
104    protected $country = '';
105
106    /**
107     * @var string
108     */
109    protected $www = '';
110
111    /**
112     * @var string
113     */
114    protected $company = '';
115
116    /**
117     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
118     */
119    protected $image;
120
121    /**
122     * @var \DateTime|null
123     */
124    protected $lastlogin;
125
126    /**
127     * Constructs a new Front-End User
128     *
129     * @param string $username
130     * @param string $password
131     */
132    public function __construct($username = '', $password = '')
133    {
134        $this->username = $username;
135        $this->password = $password;
136        $this->usergroup = new ObjectStorage();
137        $this->image = new ObjectStorage();
138    }
139
140    /**
141     * Called again with initialize object, as fetching an entity from the DB does not use the constructor
142     */
143    public function initializeObject()
144    {
145        $this->usergroup = $this->usergroup ?? new ObjectStorage();
146        $this->image = $this->image ?? new ObjectStorage();
147    }
148
149    /**
150     * Sets the username value
151     *
152     * @param string $username
153     */
154    public function setUsername($username)
155    {
156        $this->username = $username;
157    }
158
159    /**
160     * Returns the username value
161     *
162     * @return string
163     */
164    public function getUsername()
165    {
166        return $this->username;
167    }
168
169    /**
170     * Sets the password value
171     *
172     * @param string $password
173     */
174    public function setPassword($password)
175    {
176        $this->password = $password;
177    }
178
179    /**
180     * Returns the password value
181     *
182     * @return string
183     */
184    public function getPassword()
185    {
186        return $this->password;
187    }
188
189    /**
190     * Sets the usergroups. Keep in mind that the property is called "usergroup"
191     * although it can hold several usergroups.
192     *
193     * @param ObjectStorage $usergroup
194     */
195    public function setUsergroup(ObjectStorage $usergroup)
196    {
197        $this->usergroup = $usergroup;
198    }
199
200    /**
201     * Adds a usergroup to the frontend user
202     *
203     * @param FrontendUserGroup $usergroup
204     */
205    public function addUsergroup(FrontendUserGroup $usergroup)
206    {
207        $this->usergroup->attach($usergroup);
208    }
209
210    /**
211     * Removes a usergroup from the frontend user
212     *
213     * @param FrontendUserGroup $usergroup
214     */
215    public function removeUsergroup(FrontendUserGroup $usergroup)
216    {
217        $this->usergroup->detach($usergroup);
218    }
219
220    /**
221     * Returns the usergroups. Keep in mind that the property is called "usergroup"
222     * although it can hold several usergroups.
223     *
224     * @return ObjectStorage An object storage containing the usergroup
225     */
226    public function getUsergroup()
227    {
228        return $this->usergroup;
229    }
230
231    /**
232     * Sets the name value
233     *
234     * @param string $name
235     */
236    public function setName($name)
237    {
238        $this->name = $name;
239    }
240
241    /**
242     * Returns the name value
243     *
244     * @return string
245     */
246    public function getName()
247    {
248        return $this->name;
249    }
250
251    /**
252     * Sets the firstName value
253     *
254     * @param string $firstName
255     */
256    public function setFirstName($firstName)
257    {
258        $this->firstName = $firstName;
259    }
260
261    /**
262     * Returns the firstName value
263     *
264     * @return string
265     */
266    public function getFirstName()
267    {
268        return $this->firstName;
269    }
270
271    /**
272     * Sets the middleName value
273     *
274     * @param string $middleName
275     */
276    public function setMiddleName($middleName)
277    {
278        $this->middleName = $middleName;
279    }
280
281    /**
282     * Returns the middleName value
283     *
284     * @return string
285     */
286    public function getMiddleName()
287    {
288        return $this->middleName;
289    }
290
291    /**
292     * Sets the lastName value
293     *
294     * @param string $lastName
295     */
296    public function setLastName($lastName)
297    {
298        $this->lastName = $lastName;
299    }
300
301    /**
302     * Returns the lastName value
303     *
304     * @return string
305     */
306    public function getLastName()
307    {
308        return $this->lastName;
309    }
310
311    /**
312     * Sets the address value
313     *
314     * @param string $address
315     */
316    public function setAddress($address)
317    {
318        $this->address = $address;
319    }
320
321    /**
322     * Returns the address value
323     *
324     * @return string
325     */
326    public function getAddress()
327    {
328        return $this->address;
329    }
330
331    /**
332     * Sets the telephone value
333     *
334     * @param string $telephone
335     */
336    public function setTelephone($telephone)
337    {
338        $this->telephone = $telephone;
339    }
340
341    /**
342     * Returns the telephone value
343     *
344     * @return string
345     */
346    public function getTelephone()
347    {
348        return $this->telephone;
349    }
350
351    /**
352     * Sets the fax value
353     *
354     * @param string $fax
355     */
356    public function setFax($fax)
357    {
358        $this->fax = $fax;
359    }
360
361    /**
362     * Returns the fax value
363     *
364     * @return string
365     */
366    public function getFax()
367    {
368        return $this->fax;
369    }
370
371    /**
372     * Sets the email value
373     *
374     * @param string $email
375     */
376    public function setEmail($email)
377    {
378        $this->email = $email;
379    }
380
381    /**
382     * Returns the email value
383     *
384     * @return string
385     */
386    public function getEmail()
387    {
388        return $this->email;
389    }
390
391    /**
392     * Sets the lockToDomain value
393     *
394     * @param string $lockToDomain
395     */
396    public function setLockToDomain($lockToDomain)
397    {
398        $this->lockToDomain = $lockToDomain;
399    }
400
401    /**
402     * Returns the lockToDomain value
403     *
404     * @return string
405     */
406    public function getLockToDomain()
407    {
408        return $this->lockToDomain;
409    }
410
411    /**
412     * Sets the title value
413     *
414     * @param string $title
415     */
416    public function setTitle($title)
417    {
418        $this->title = $title;
419    }
420
421    /**
422     * Returns the title value
423     *
424     * @return string
425     */
426    public function getTitle()
427    {
428        return $this->title;
429    }
430
431    /**
432     * Sets the zip value
433     *
434     * @param string $zip
435     */
436    public function setZip($zip)
437    {
438        $this->zip = $zip;
439    }
440
441    /**
442     * Returns the zip value
443     *
444     * @return string
445     */
446    public function getZip()
447    {
448        return $this->zip;
449    }
450
451    /**
452     * Sets the city value
453     *
454     * @param string $city
455     */
456    public function setCity($city)
457    {
458        $this->city = $city;
459    }
460
461    /**
462     * Returns the city value
463     *
464     * @return string
465     */
466    public function getCity()
467    {
468        return $this->city;
469    }
470
471    /**
472     * Sets the country value
473     *
474     * @param string $country
475     */
476    public function setCountry($country)
477    {
478        $this->country = $country;
479    }
480
481    /**
482     * Returns the country value
483     *
484     * @return string
485     */
486    public function getCountry()
487    {
488        return $this->country;
489    }
490
491    /**
492     * Sets the www value
493     *
494     * @param string $www
495     */
496    public function setWww($www)
497    {
498        $this->www = $www;
499    }
500
501    /**
502     * Returns the www value
503     *
504     * @return string
505     */
506    public function getWww()
507    {
508        return $this->www;
509    }
510
511    /**
512     * Sets the company value
513     *
514     * @param string $company
515     */
516    public function setCompany($company)
517    {
518        $this->company = $company;
519    }
520
521    /**
522     * Returns the company value
523     *
524     * @return string
525     */
526    public function getCompany()
527    {
528        return $this->company;
529    }
530
531    /**
532     * Sets the image value
533     *
534     * @param ObjectStorage $image
535     */
536    public function setImage(ObjectStorage $image)
537    {
538        $this->image = $image;
539    }
540
541    /**
542     * Gets the image value
543     *
544     * @return ObjectStorage
545     */
546    public function getImage()
547    {
548        return $this->image;
549    }
550
551    /**
552     * Sets the lastlogin value
553     *
554     * @param \DateTime $lastlogin
555     */
556    public function setLastlogin(\DateTime $lastlogin)
557    {
558        $this->lastlogin = $lastlogin;
559    }
560
561    /**
562     * Returns the lastlogin value
563     *
564     * @return \DateTime
565     */
566    public function getLastlogin()
567    {
568        return $this->lastlogin;
569    }
570}
571