-
Notifications
You must be signed in to change notification settings - Fork 249
Expand file tree
/
Copy pathUserFactory.class.php
More file actions
82 lines (72 loc) · 1.87 KB
/
UserFactory.class.php
File metadata and controls
82 lines (72 loc) · 1.87 KB
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
<?php
namespace DBA;
class UserFactory extends AbstractModelFactory {
function getModelName() {
return "User";
}
function getModelTable() {
return "User";
}
function isCachable() {
return false;
}
function getCacheValidTime() {
return -1;
}
/**
* @return User
*/
function getNullObject() {
$o = new User(-1, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
return $o;
}
/**
* @param string $pk
* @param array $dict
* @return User
*/
function createObjectFromDict($pk, $dict) {
$o = new User($dict['userId'], $dict['username'], $dict['email'], $dict['passwordHash'], $dict['passwordSalt'], $dict['isValid'], $dict['isLDAP'], $dict['isComputedPassword'], $dict['lastLoginDate'], $dict['registeredSince'], $dict['sessionLifetime'], $dict['rightGroupId'], $dict['yubikey'], $dict['otp1'], $dict['otp2'], $dict['otp3'], $dict['otp4']);
return $o;
}
/**
* @param array $options
* @param bool $single
* @return User|User[]
*/
function filter($options, $single = false) {
$join = false;
if (array_key_exists('join', $options)) {
$join = true;
}
if ($single) {
if ($join) {
return parent::filter($options, $single);
}
return Util::cast(parent::filter($options, $single), User::class);
}
$objects = parent::filter($options, $single);
if ($join) {
return $objects;
}
$models = array();
foreach ($objects as $object) {
$models[] = Util::cast($object, User::class);
}
return $models;
}
/**
* @param string $pk
* @return User
*/
function get($pk) {
return Util::cast(parent::get($pk), User::class);
}
/**
* @param User $model
* @return User
*/
function save($model) {
return Util::cast(parent::save($model), User::class);
}
}