|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Blackmine\Model\User; |
|
6
|
|
|
|
|
7
|
|
|
use Blackmine\Model\CustomField; |
|
8
|
|
|
use Blackmine\Model\NamedIdentity; |
|
9
|
|
|
use Carbon\CarbonImmutable; |
|
10
|
|
|
use Blackmine\Collection\IdentityCollection; |
|
11
|
|
|
use Blackmine\Repository\Users\Users; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @method void setLogin(string $login) |
|
15
|
|
|
* @method void setFirstname(string $firstname) |
|
16
|
|
|
* @method void setLastname(string $lastname) |
|
17
|
|
|
* @method void setMail(string $mail) |
|
18
|
|
|
* @method void setStatus(int $status) |
|
19
|
|
|
* |
|
20
|
|
|
* @method string getLogin() |
|
21
|
|
|
* @method string getFirstname() |
|
22
|
|
|
* @method string getLastname() |
|
23
|
|
|
* @method string getMail() |
|
24
|
|
|
* @method string getStatus() |
|
25
|
|
|
* @method CarbonImmutable getCreatedOn() |
|
26
|
|
|
* @method CarbonImmutable getLastLoginOn() |
|
27
|
|
|
* @method IdentityCollection getCustomFields() |
|
28
|
|
|
* @method IdentityCollection getMemberships() |
|
29
|
|
|
* @method IdentityCollection getGroups() |
|
30
|
|
|
* |
|
31
|
|
|
* @method addCustomField(CustomField $custom_field) |
|
32
|
|
|
* @method removeCustomField(CustomField $custom_field) |
|
33
|
|
|
* @method addGroup(Group $group) |
|
34
|
|
|
* @method removeGroup(Group $group) |
|
35
|
|
|
* @method addMembership(Membership $membership) |
|
36
|
|
|
* @method removeMembership(Membership $membership) |
|
37
|
|
|
*/ |
|
38
|
|
|
class User extends NamedIdentity |
|
39
|
|
|
{ |
|
40
|
|
|
public const ENTITY_NAME = "user"; |
|
41
|
|
|
|
|
42
|
|
|
protected string $login; |
|
43
|
|
|
protected string $firstname; |
|
44
|
|
|
protected string $lastname; |
|
45
|
|
|
protected string $mail; |
|
46
|
|
|
protected int $status; |
|
47
|
|
|
protected string $api_key; |
|
48
|
|
|
|
|
49
|
|
|
protected IdentityCollection $custom_fields; |
|
50
|
|
|
protected IdentityCollection $memberships; |
|
51
|
|
|
protected IdentityCollection $groups; |
|
52
|
|
|
|
|
53
|
|
|
protected CarbonImmutable $created_on; |
|
54
|
|
|
protected CarbonImmutable $last_login_on; |
|
55
|
|
|
|
|
56
|
|
|
public static function getRepositoryClass(): ?string |
|
57
|
|
|
{ |
|
58
|
|
|
return Users::class; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function getName(): string |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->firstname . " " . $this->lastname; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|