From ae3890da189532ea997be0f9de85da85dc629950 Mon Sep 17 00:00:00 2001 From: secretr Date: Sat, 20 Nov 2010 15:39:21 +0000 Subject: [PATCH] model - better parameter handling --- e107_handlers/model_class.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index a1a679794..be7df75bf 100644 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -1117,7 +1117,8 @@ class e_model */ public function setParams(array $params) { - $this->_params = $params; + $this->_params = array(); + $this->updateParams($params); return $this; } @@ -1128,7 +1129,11 @@ class e_model */ public function updateParams(array $params) { - $this->_params = array_merge($this->_params, $params); + foreach ($params as $k => $v) + { + $this->setParam($k, $v); + } + return $this; } @@ -1151,7 +1156,12 @@ class e_model */ public function setParam($key, $value) { - $this->_params[$key] = $value; + if(null == $value) + { + unset($this->_params[$key]); + } + else $this->_params[$key] = $value; + return $this; }