1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

model - better parameter handling

This commit is contained in:
secretr
2010-11-20 15:39:21 +00:00
parent 1c9863fcf5
commit ae3890da18

View File

@@ -1117,7 +1117,8 @@ class e_model
*/ */
public function setParams(array $params) public function setParams(array $params)
{ {
$this->_params = $params; $this->_params = array();
$this->updateParams($params);
return $this; return $this;
} }
@@ -1128,7 +1129,11 @@ class e_model
*/ */
public function updateParams(array $params) public function updateParams(array $params)
{ {
$this->_params = array_merge($this->_params, $params); foreach ($params as $k => $v)
{
$this->setParam($k, $v);
}
return $this; return $this;
} }
@@ -1151,7 +1156,12 @@ class e_model
*/ */
public function setParam($key, $value) public function setParam($key, $value)
{ {
$this->_params[$key] = $value; if(null == $value)
{
unset($this->_params[$key]);
}
else $this->_params[$key] = $value;
return $this; return $this;
} }