diff options
Diffstat (limited to 'user_guide_src/source')
-rw-r--r-- | user_guide_src/source/database/results.rst | 13 |
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) |