summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries/MY_ORM.php
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2012-06-01 15:10:46 +0000
committerNathan Kinkade <nath@nkinka.de>2012-06-01 15:10:46 +0000
commitb52e834bd0bab530e98537d52b31d4b37f199739 (patch)
treeff31dd4f6c2afaeae380f10dc691cde3cb4e6739 /modules/gallery/libraries/MY_ORM.php
parentf5098f54b8279f468d94747b1156e15ea05d6d25 (diff)
parent4c98b218316df00c8bf3eeb28a8324ec64348bff (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/libraries/MY_ORM.php')
-rw-r--r--modules/gallery/libraries/MY_ORM.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/gallery/libraries/MY_ORM.php b/modules/gallery/libraries/MY_ORM.php
index d4cdedb8..4194162b 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) && !is_string($id)) {
+ throw new Exception("@todo ORM::factory requires integer ids");
+ }
+ return ORM_Core::factory($model, (int) $id);
+ }
+
public function save() {
model_cache::clear();
return parent::save();