From ce34e89c899a3fca6d647e99742c39b8b7a4f3e0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 15 May 2012 09:50:57 -0700 Subject: Different approach to resolving #1865, this replaces 6a6b3f90f36293a40cba091c3ac387abb64f3c1a which was rolled back. --- modules/gallery/libraries/MY_ORM.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/MY_ORM.php b/modules/gallery/libraries/MY_ORM.php index d4cdedb8..ac61e75b 100644 --- a/modules/gallery/libraries/MY_ORM.php +++ b/modules/gallery/libraries/MY_ORM.php @@ -18,6 +18,17 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class ORM extends ORM_Core { + + /** + * Make sure that we're only using integer ids. + */ + static function factory($model, $id=null) { + if ($id && !is_int($id)) { + throw new Exception("@todo ORM::factory requires integer ids"); + } + return ORM_Core::factory($model, $id); + } + public function save() { model_cache::clear(); return parent::save(); -- cgit v1.2.3