1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

Model corrections

This commit is contained in:
secretr
2009-10-27 17:49:12 +00:00
parent e7d906c489
commit 4fd695bf57

View File

@@ -9,9 +9,9 @@
* e107 Base Model * e107 Base Model
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
* $Revision: 1.24 $ * $Revision: 1.25 $
* $Date: 2009-10-26 08:12:59 $ * $Date: 2009-10-27 17:49:12 $
* $Author: e107coders $ * $Author: secretr $
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -958,7 +958,7 @@ class e_admin_model extends e_model
* Set object validation rules if $_validation_rules array is empty * Set object validation rules if $_validation_rules array is empty
* *
* @param array $vrules * @param array $vrules
* @return e_model * @return e_admin_model
*/ */
public function setValidationRules(array $vrules) public function setValidationRules(array $vrules)
{ {
@@ -1038,7 +1038,7 @@ class e_admin_model extends e_model
* @param mixed $value * @param mixed $value
* @param boolean $strict update only * @param boolean $strict update only
* @param boolean $toForm use post_toForm() on both key and data arguments * @param boolean $toForm use post_toForm() on both key and data arguments
* @return e_model * @return e_admin_model
*/ */
public function setPosted($key, $value, $strict = false, $toForm = true) public function setPosted($key, $value, $strict = false, $toForm = true)
{ {
@@ -1061,7 +1061,7 @@ class e_admin_model extends e_model
* @param mixed $value * @param mixed $value
* @param boolean $strict update only * @param boolean $strict update only
* @param boolean $toForm use post_toForm() on both key and data arguments * @param boolean $toForm use post_toForm() on both key and data arguments
* @return e_model * @return e_admin_model
*/ */
public function setPostedData($key, $value = null, $strict = false, $toForm = true) public function setPostedData($key, $value = null, $strict = false, $toForm = true)
{ {
@@ -1085,7 +1085,7 @@ class e_admin_model extends e_model
* @param mixed $value * @param mixed $value
* @param boolean $override override existing data * @param boolean $override override existing data
* @param boolean $toForm use post_toForm() on both key and data arguments * @param boolean $toForm use post_toForm() on both key and data arguments
* @return e_model * @return e_admin_model
*/ */
public function addPostedData($key, $value = null, $override = true, $toForm = true) public function addPostedData($key, $value = null, $override = true, $toForm = true)
{ {
@@ -1103,7 +1103,7 @@ class e_admin_model extends e_model
* Public proxy of {@link _unsetDataSimple()} * Public proxy of {@link _unsetDataSimple()}
* *
* @param string $key * @param string $key
* @return e_model * @return e_admin_model
*/ */
public function removePosted($key) public function removePosted($key)
{ {
@@ -1119,7 +1119,7 @@ class e_admin_model extends e_model
* Public proxy of {@link _unsetData()} * Public proxy of {@link _unsetData()}
* *
* @param string|null $key * @param string|null $key
* @return e_model * @return e_admin_model
*/ */
public function removePostedData($key = null) public function removePostedData($key = null)
{ {
@@ -1196,12 +1196,11 @@ class e_admin_model extends e_model
* *
* If $strict is true, only existing object data will be copied (update) * If $strict is true, only existing object data will be copied (update)
* If $validate is true, data will be copied only after successful validation * If $validate is true, data will be copied only after successful validation
* TODO - move to admin e_model extension?
* *
* @param boolean $strict * @param boolean $strict
* @param boolean $sanitize sanitize posted data before move it to the object data * @param boolean $sanitize sanitize posted data before move it to the object data
* @param boolean $validate perform validation check * @param boolean $validate perform validation check
* @return e_model * @return e_admin_model
*/ */
public function mergePostedData($strict = true, $sanitize = true, $validate = true) public function mergePostedData($strict = true, $sanitize = true, $validate = true)
{ {
@@ -1250,12 +1249,11 @@ class e_admin_model extends e_model
* *
* If $strict is true, only existing object data will be copied (update) * If $strict is true, only existing object data will be copied (update)
* If $validate is true, data will be copied only after successful validation * If $validate is true, data will be copied only after successful validation
* TODO - move to admin e_model extension?
* *
* @param array $src_data * @param array $src_data
* @param boolean $sanitize * @param boolean $sanitize
* @param boolean $validate perform validation check * @param boolean $validate perform validation check
* @return e_model * @return e_admin_model
*/ */
public function mergeData(array $src_data, $strict = true, $sanitize = true, $validate = true) public function mergeData(array $src_data, $strict = true, $sanitize = true, $validate = true)
{ {
@@ -1590,10 +1588,10 @@ class e_admin_model extends e_model
$ret = array(); $ret = array();
foreach ($key as $k=>$v) foreach ($key as $k=>$v)
{ {
if(isset($this->_data_fields[$k])) if(isset($this->_data_fields[$k]))
{ {
$ret[$k] = $this->toDb($k, $v); $ret[$k] = $this->sanitize($k, $v);
} }
} }
return $ret; return $ret;
} }
@@ -2268,4 +2266,3 @@ class e_model_interface
} }