|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class User extends \Phalcon\Mvc\Model |
|
|
|
|
|
|
4
|
|
|
{ |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* |
|
8
|
|
|
* @var integer |
|
9
|
|
|
*/ |
|
10
|
|
|
protected $id; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* |
|
14
|
|
|
* @var string |
|
15
|
|
|
*/ |
|
16
|
|
|
protected $mail; |
|
17
|
|
|
|
|
18
|
|
|
protected $image; |
|
19
|
|
|
/** |
|
20
|
|
|
* |
|
21
|
|
|
* @var string |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $password; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* |
|
27
|
|
|
* @var string |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $identite; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* |
|
33
|
|
|
* @var string |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $role; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Method to set the value of field id |
|
39
|
|
|
* |
|
40
|
|
|
* @param integer $id |
|
41
|
|
|
* @return $this |
|
42
|
|
|
*/ |
|
43
|
|
|
public function setId($id) |
|
44
|
|
|
{ |
|
45
|
|
|
$this->id = $id; |
|
46
|
|
|
|
|
47
|
|
|
return $this; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Method to set the value of field mail |
|
52
|
|
|
* |
|
53
|
|
|
* @param string $mail |
|
54
|
|
|
* @return $this |
|
55
|
|
|
*/ |
|
56
|
|
|
public function setMail($mail) |
|
57
|
|
|
{ |
|
58
|
|
|
$this->mail = $mail; |
|
59
|
|
|
|
|
60
|
|
|
return $this; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Method to set the value of field password |
|
65
|
|
|
* |
|
66
|
|
|
* @param string $password |
|
67
|
|
|
* @return $this |
|
68
|
|
|
*/ |
|
69
|
|
|
public function setPassword($password) |
|
70
|
|
|
{ |
|
71
|
|
|
$this->password = $password; |
|
72
|
|
|
|
|
73
|
|
|
return $this; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Method to set the value of field identite |
|
78
|
|
|
* |
|
79
|
|
|
* @param string $identite |
|
80
|
|
|
* @return $this |
|
81
|
|
|
*/ |
|
82
|
|
|
public function setIdentite($identite) |
|
83
|
|
|
{ |
|
84
|
|
|
$this->identite = $identite; |
|
85
|
|
|
|
|
86
|
|
|
return $this; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Method to set the value of field role |
|
91
|
|
|
* |
|
92
|
|
|
* @param string $role |
|
93
|
|
|
* @return $this |
|
94
|
|
|
*/ |
|
95
|
|
|
public function setRole($role) |
|
96
|
|
|
{ |
|
97
|
|
|
$this->role = $role; |
|
98
|
|
|
|
|
99
|
|
|
return $this; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
public function setImage($image){ |
|
103
|
|
|
$this->image = $image; |
|
104
|
|
|
return $this; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* Returns the value of field id |
|
109
|
|
|
* |
|
110
|
|
|
* @return integer |
|
111
|
|
|
*/ |
|
112
|
|
|
public function getId() |
|
113
|
|
|
{ |
|
114
|
|
|
return $this->id; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Returns the value of field mail |
|
119
|
|
|
* |
|
120
|
|
|
* @return string |
|
121
|
|
|
*/ |
|
122
|
|
|
public function getMail() |
|
123
|
|
|
{ |
|
124
|
|
|
return $this->mail; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
public function getImage(){ |
|
128
|
|
|
return $this->image; |
|
129
|
|
|
} |
|
130
|
|
|
/** |
|
131
|
|
|
* Returns the value of field password |
|
132
|
|
|
* |
|
133
|
|
|
* @return string |
|
134
|
|
|
*/ |
|
135
|
|
|
public function getPassword() |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->password; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* Returns the value of field identite |
|
142
|
|
|
* |
|
143
|
|
|
* @return string |
|
144
|
|
|
*/ |
|
145
|
|
|
public function getIdentite() |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->identite; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* Returns the value of field role |
|
152
|
|
|
* |
|
153
|
|
|
* @return string |
|
154
|
|
|
*/ |
|
155
|
|
|
public function getRole() |
|
156
|
|
|
{ |
|
157
|
|
|
return $this->role; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* Initialize method for model. |
|
162
|
|
|
*/ |
|
163
|
|
|
public function initialize() |
|
164
|
|
|
{ |
|
165
|
|
|
$this->hasMany('id', 'Message', 'idUser', array('alias' => 'Messages')); |
|
166
|
|
|
$this->hasMany('id', 'Projet', 'idClient', array('alias' => 'Projets')); |
|
167
|
|
|
$this->hasMany('id', 'Usecase', 'idDev', array('alias' => 'Usecases')); |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
public function toString(){ |
|
171
|
|
|
return $this->identite."(".$this->mail.")"; |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
//Return a string containing the principal content of the model |
|
175
|
|
|
public function getPrincipal(){ |
|
176
|
|
|
return "Identité : ".$this->identite." <br/> Email : ".$this->mail; |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* Returns table name mapped in the model. |
|
182
|
|
|
* |
|
183
|
|
|
* @return string |
|
184
|
|
|
*/ |
|
185
|
|
|
public function getSource() |
|
186
|
|
|
{ |
|
187
|
|
|
return 'user'; |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* Allows to query a set of records that match the specified conditions |
|
192
|
|
|
* |
|
193
|
|
|
* @param mixed $parameters |
|
194
|
|
|
* @return User[] |
|
195
|
|
|
*/ |
|
196
|
|
|
public static function find($parameters = null) |
|
197
|
|
|
{ |
|
198
|
|
|
return parent::find($parameters); |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
/** |
|
202
|
|
|
* Allows to query the first record that match the specified conditions |
|
203
|
|
|
* |
|
204
|
|
|
* @param mixed $parameters |
|
205
|
|
|
* @return User |
|
206
|
|
|
*/ |
|
207
|
|
|
public static function findFirst($parameters = null) |
|
208
|
|
|
{ |
|
209
|
|
|
return parent::findFirst($parameters); |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
} |
|
213
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.