1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Alpixel\Bundle\UserBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use FOS\UserBundle\Entity\User as BaseUser; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Page. |
10
|
|
|
* |
11
|
|
|
* @ORM\Table(name="account_admin") |
12
|
|
|
* @ORM\Entity |
13
|
|
|
*/ |
14
|
|
|
class Admin extends BaseUser |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @var integer |
18
|
|
|
* |
19
|
|
|
* @ORM\Id |
20
|
|
|
* @ORM\Column(name="admin_id", type="integer", nullable=false) |
21
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
22
|
|
|
*/ |
23
|
|
|
protected $id; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
* |
28
|
|
|
* @ORM\Column(name="firstname", type="string", length=150, nullable=false) |
29
|
|
|
*/ |
30
|
|
|
protected $firstname; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string |
34
|
|
|
* |
35
|
|
|
* @ORM\Column(name="lastname", type="string", length=150, nullable=false) |
36
|
|
|
*/ |
37
|
|
|
protected $lastname; |
38
|
|
|
|
39
|
|
|
public function __construct() |
40
|
|
|
{ |
41
|
|
|
parent::__construct(); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function __toString() |
45
|
|
|
{ |
46
|
|
|
return $this->firstname.' '.strtoupper($this->lastname); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function getParent() |
50
|
|
|
{ |
51
|
|
|
return 'FOSUserBundle'; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public static function getRoleString($key) |
55
|
|
|
{ |
56
|
|
|
$roles = array( |
57
|
|
|
'ROLE_USER' => 'Simple utilisateur', |
58
|
|
|
'ROLE_MODERATOR' => 'Modérateur', |
59
|
|
|
'ROLE_MODERATOR_LEADER' => 'Chef d\'équipe modérateur', |
60
|
|
|
'ROLE_SUPER_ADMIN' => 'Administrateur du site', |
61
|
|
|
); |
62
|
|
|
|
63
|
|
|
if (!empty($roles[$key])) { |
64
|
|
|
return $roles[$key]; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
return $key; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Gets the value of id. |
72
|
|
|
* |
73
|
|
|
* @return integer |
74
|
|
|
*/ |
75
|
|
|
public function getID() |
76
|
|
|
{ |
77
|
|
|
return $this->id; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Sets the value of id. |
82
|
|
|
* |
83
|
|
|
* @param integer $id the id |
84
|
|
|
* |
85
|
|
|
* @return self |
86
|
|
|
*/ |
87
|
|
|
public function setID($id) |
88
|
|
|
{ |
89
|
|
|
$this->id = $id; |
90
|
|
|
|
91
|
|
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Gets the value of firstname. |
96
|
|
|
* |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
|
|
public function getFirstname() |
100
|
|
|
{ |
101
|
|
|
return $this->firstname; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Sets the value of firstname. |
106
|
|
|
* |
107
|
|
|
* @param string $firstname the firstname |
108
|
|
|
* |
109
|
|
|
* @return self |
110
|
|
|
*/ |
111
|
|
|
public function setFirstname($firstname) |
112
|
|
|
{ |
113
|
|
|
$this->firstname = $firstname; |
114
|
|
|
|
115
|
|
|
return $this; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Gets the value of lastname. |
120
|
|
|
* |
121
|
|
|
* @return string |
122
|
|
|
*/ |
123
|
|
|
public function getLastname() |
124
|
|
|
{ |
125
|
|
|
return $this->lastname; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Sets the value of lastname. |
130
|
|
|
* |
131
|
|
|
* @param string $lastname the lastname |
132
|
|
|
* |
133
|
|
|
* @return self |
134
|
|
|
*/ |
135
|
|
|
public function setLastname($lastname) |
136
|
|
|
{ |
137
|
|
|
$this->lastname = $lastname; |
138
|
|
|
|
139
|
|
|
return $this; |
140
|
|
|
} |
141
|
|
|
} |
142
|
|
|
|