1 | <?php |
||
13 | class UserModel implements |
||
14 | ConfigureInterface, |
||
15 | InjectionAwareInterface |
||
16 | { |
||
17 | use ConfigureTrait, |
||
18 | InjectionAwareTrait; |
||
19 | |||
20 | /** |
||
21 | * Variables |
||
22 | */ |
||
23 | //private $session; |
||
24 | |||
25 | |||
26 | /** |
||
27 | * Create a new User. |
||
28 | * The acronym is unique! |
||
29 | * |
||
30 | * @param object $newUser the values of the new user. |
||
31 | * |
||
32 | * $newUser = (object) [ |
||
33 | * acronym => name, |
||
34 | * password => hashing in function!, |
||
35 | * email => , |
||
36 | * created => timestamp in function, |
||
37 | * updated => null, |
||
38 | * deleted => null, |
||
39 | * active => null, |
||
40 | * admin => 0, |
||
41 | * ]; |
||
42 | * |
||
43 | * @return object $user if acronym unique, false otherwise. |
||
44 | */ |
||
45 | 1 | public function createUser($newUser) |
|
69 | |||
70 | |||
71 | /** |
||
72 | * Save a user to session. |
||
73 | * |
||
74 | * @param object $user the values of the user. |
||
75 | * |
||
76 | * $user = (object) [ |
||
77 | * acronym => name, |
||
78 | * password => hashed, |
||
79 | * email => email, |
||
80 | * created => timestamp, |
||
81 | * updated => null/timestamp, |
||
82 | * deleted => null/timestamp, |
||
83 | * active => null/timestamp, |
||
84 | * admin => 0/1, |
||
85 | * ]; |
||
86 | * |
||
87 | * @return void |
||
88 | */ |
||
89 | 1 | public function saveToSession($user) |
|
103 | |||
104 | |||
105 | /** |
||
106 | * Get a user from the database |
||
107 | * |
||
108 | * @param int $id the id of the user |
||
109 | * |
||
110 | * @return object $user the user object |
||
111 | */ |
||
112 | 1 | public function getUserFromDatabase($id) |
|
121 | } |
||
122 |