From 194cc3b27a73afe5119da9f09407c1e068dc6fa3 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 5 Oct 2009 14:04:27 -0700 Subject: First pass on converting calls to the Identity interface. Will worry about writes and saves later. Convert the Admin_User controller Convert the login and password change controller Change the item model to call user::lookup to get the owner. On the log model, delete the relationship between the log and user table, and replace with a call to user::lookup --- modules/gallery/models/log.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'modules/gallery/models/log.php') diff --git a/modules/gallery/models/log.php b/modules/gallery/models/log.php index 6734afb8..d143d7bd 100644 --- a/modules/gallery/models/log.php +++ b/modules/gallery/models/log.php @@ -18,5 +18,20 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Log_Model extends ORM { - protected $has_one = array("user"); + /** + * @see ORM::__get() + */ + public function __get($column) { + if ($column == "user") { + // This relationship depends on an outside module, which may not be present so handle + // failures gracefully. + try { + return user::lookup($this->user_id); + } catch (Exception $e) { + return null; + } + } else { + return parent::__get($column); + } + } } -- cgit v1.2.3