-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathUsers.php
190 lines (163 loc) · 3.07 KB
/
Users.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
use Phalcon\Validation;
use Phalcon\Validation\Validator\Email as EmailValidator;
class Users extends \Phalcon\Mvc\Model
{
/**
*
* @var integer
*/
public $id;
/**
*
* @var string
*/
public $username;
/**
*
* @var string
*/
public $password;
/**
*
* @var string
*/
public $firstname;
/**
*
* @var string
*/
public $lastname;
/**
*
* @var string
*/
public $level;
/**
*
* @var string
*/
public $email;
/**
*
* @var string
*/
public $phone;
/**
*
* @var string
*/
public $mobile;
/**
*
* @var string
*/
public $address;
/**
*
* @var string
*/
public $country;
/**
*
* @var string
*/
public $city;
/**
*
* @var string
*/
public $birthday;
/**
*
* @var integer
*/
public $authorised;
/**
*
* @var string
*/
public $block_expires;
/**
*
* @var integer
*/
public $login_attempts;
/**
* Initialize method for model.
*/
public function initialize()
{
$this->setConnectionService('db');
}
/**
* Validations and business logic
*
* @return boolean
*/
public function validation()
{
$validator = new Validation();
$validator->add(
'email',
new EmailValidator()
);
return $this->validate($validator);
}
/**
* Returns table name mapped in the model.
*
* @return string
*/
public function getSource()
{
return 'users';
}
/**
* Allows to query a set of records that match the specified conditions
*
* @param mixed $parameters
* @return Users[]
*/
public static function find($parameters = null)
{
return parent::find($parameters);
}
/**
* Allows to query the first record that match the specified conditions
*
* @param mixed $parameters
* @return Users
*/
public static function findFirst($parameters = null)
{
return parent::findFirst($parameters);
}
/**
* Independent Column Mapping.
* Keys are the real names in the table and the values their names in the application
*
* @return array
*/
public function columnMap()
{
return array(
'id' => 'id',
'username' => 'username',
'password' => 'password',
'firstname' => 'firstname',
'lastname' => 'lastname',
'level' => 'level',
'email' => 'email',
'phone' => 'phone',
'mobile' => 'mobile',
'address' => 'address',
'country' => 'country',
'city' => 'city',
'birthday' => 'birthday',
'authorised' => 'authorised',
'block_expires' => 'block_expires',
'login_attempts' => 'login_attempts',
);
}
}