summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2012-05-15 09:50:57 -0700
committerBharat Mediratta <bharat@menalto.com>2012-05-15 09:50:57 -0700
commitce34e89c899a3fca6d647e99742c39b8b7a4f3e0 (patch)
tree178b44e52a6b66d85af07d1f18c9f2e5b8570f06
parent0d5187eadf3e19729c6aa25c3bf30d2787fd66a3 (diff)
Different approach to resolving #1865, this replaces 6a6b3f90f36293a40cba091c3ac387abb64f3c1a
which was rolled back.
-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..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();