From e3c7337c646cbd63ceb93c03b827889230c3d9f0 Mon Sep 17 00:00:00 2001 From: SecretR Date: Sun, 6 Oct 2013 18:03:49 +0300 Subject: [PATCH] Models could use load() without primary id --- e107_handlers/model_class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index 30df9026a..f22cb8bbc 100644 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -1453,10 +1453,11 @@ class e_model extends e_object /** * Generic load data from DB + * @param mixed $id * @param boolean $force * @return e_model */ - public function load($id, $force = false) + public function load($id = null, $force = false) { if(!$force && $this->getId()) { @@ -1468,8 +1469,8 @@ class e_model extends e_object $this->setData(array()) ->_clearCacheData(); } - $id = e107::getParser()->toDB($id); - if(!$id) + if($id) $id = e107::getParser()->toDB($id); + if(!$id && !$this->getParam('db_query')) { return $this; }