Last change
on this file since 186 was
186,
checked in by jkraaijeveld, 13 years ago
|
Implemented lazy evaluation.
- Initially, references to other database objects are now given as an ID rather than an object.
- Every model class now has an evaluate() function, which gets all the objects that object has references to. Returns true if it got all the values correctly, false if there are invalid references.
- Every connector now first evaluates an object before storing, to make sure only objects with valid references get stored.
|
File size:
696 bytes
|
Rev | Line | |
---|
[131] | 1 | <?php |
---|
| 2 | |
---|
| 3 | /** |
---|
| 4 | * Description of User |
---|
| 5 | * |
---|
| 6 | * @author jkraaijeveld |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | class User extends ResearchToolObject { |
---|
| 10 | |
---|
| 11 | public $name; |
---|
| 12 | public $password; |
---|
| 13 | |
---|
| 14 | /** |
---|
| 15 | * Constructor of User |
---|
| 16 | * If the user does not yet exist in the database, call with null as first parameter |
---|
| 17 | */ |
---|
| 18 | public function __construct($uid = null, $name = null, $password = null) { |
---|
| 19 | if(!isset($uid)) |
---|
| 20 | { |
---|
| 21 | $uid = md5(uniqid(rand(), true)); |
---|
| 22 | } |
---|
| 23 | $this->uid = $uid; |
---|
| 24 | $this->name = $name; |
---|
| 25 | $this->password = $password; |
---|
[186] | 26 | } |
---|
| 27 | |
---|
| 28 | /** |
---|
| 29 | * function evaluate() |
---|
| 30 | * Evaluates all the references of this object. |
---|
| 31 | */ |
---|
| 32 | public function evaluate() |
---|
| 33 | { |
---|
| 34 | //Do nothing. |
---|
| 35 | } |
---|
| 36 | |
---|
[131] | 37 | } |
---|
| 38 | |
---|
| 39 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.