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
<?php
class User extends Model
{
// ===========
// = Statics =
// ===========
protected static $table_name = 'USER';
// load all users from Db
public static function getList()
{
$stm = parent::exec('USER_LIST');
return $stm->fetchAll();
}
public static function getRow($id)
{
$stm = parent::exec('USER_GET_WITH_ID', ['id' => $id]);
return $stm->fetchAll();
}
public static function updateUser($array)
{
$stm = parent::exec('USER_UPDATE', $array);
}
public static function tryLogin($login)
{
$stm = parent::exec('USER_GET_WITH_LOGIN', ['login' => $login]);
return $stm->fetchAll(PDO::FETCH_CLASS, 'User')[0];
}
public function password()
{
return trim($this->USER_PWD);
}
public function id()
{
return trim($this->USER_ID);
}
public function firstname()
{
return trim($this->USER_NAME);
}
public function lastname()
{
return trim($this->USER_SURNAME);
}
public function email()
{
return trim($this->USER_EMAIL);
}
}