summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source
diff options
context:
space:
mode:
authorLonnie Ezell <lonnieje@gmail.com>2015-07-22 16:00:37 +0200
committerLonnie Ezell <lonnieje@gmail.com>2015-07-22 16:00:37 +0200
commitabf089a6c8f50c86601548abf7e827f4d067a348 (patch)
tree2556797d4392d36d45f9c2826e9964da36691fad /user_guide_src/source
parent2520182d875b6b5c9589cc6d8b55ce9c6a6ce5ce (diff)
Revamping User class example for Custom Result Objects
Diffstat (limited to 'user_guide_src/source')
-rw-r--r--user_guide_src/source/database/results.rst13
1 files changed, 5 insertions, 8 deletions
diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst
index 2a2cf38ab..3837a7736 100644
--- a/user_guide_src/source/database/results.rst
+++ b/user_guide_src/source/database/results.rst
@@ -193,18 +193,15 @@ Example::
public function last_login($format)
{
- $date = DateTime::setTimestamp($this->last_login);
- return $date->format($format);
+ return $this->last_login->format($format);
}
public function __set($name, $value)
{
- $allowed_vars = array('id', 'email', 'username');
-
- if (in_array($allowed_vars, $name)
- {
- $this->$name = $value;
- }
+ if ($name === 'last_login')
+ {
+ $this->last_login = DateTime::createFromFormat('U', $value);
+ }
}
public function __get($name)