From: avl Date: Thu, 21 Aug 2008 03:44:29 +0000 (+0300) Subject: File Uploads & Ready for first project X-Git-Tag: 0.6~184 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=75e9318cfbcb2970abd40bc1e449a8eb2c3a3e62;p=ipf-legacy-orm.git File Uploads & Ready for first project --- diff --git a/ipf/orm/record.php b/ipf/orm/record.php index 7b2b03c..fd81dcc 100644 --- a/ipf/orm/record.php +++ b/ipf/orm/record.php @@ -1257,16 +1257,15 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab return null; } - function SetFromFormData($cleaned_values) + public function SetFromFormData($cleaned_values) { - //$relations = $this->getTable()->getRelations(); foreach ($cleaned_values as $key=>$val) { - /* - if (array_key_exists($key,$relations)){ - - - }else*/ - $this->$key = $val; + $validators = $this->getTable()->getFieldValidators($key); + if (array_key_exists('image',$validators) || array_key_exists('file',$validators)){ + if ($val=='') + continue; + } + $this->$key = $val; } } } \ No newline at end of file diff --git a/ipf/orm/table.php b/ipf/orm/table.php index 6403fa8..9f00d7b 100644 --- a/ipf/orm/table.php +++ b/ipf/orm/table.php @@ -1271,6 +1271,10 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable $columnName = $this->getColumnName($fieldName); // this loop is a dirty workaround to get the validators filtered out of // the options, since everything is squeezed together currently + + if (!isset($this->_columns[$columnName])) + return array(); + foreach ($this->_columns[$columnName] as $name => $args) { if (empty($name) || $name == 'primary' diff --git a/ipf/orm/utils.php b/ipf/orm/utils.php index 5afd7da..5664c70 100644 --- a/ipf/orm/utils.php +++ b/ipf/orm/utils.php @@ -54,6 +54,8 @@ class IPF_ORM_Utils { 'unique', 'unsigned', 'usstate', + 'file', + 'image', ); } diff --git a/ipf/orm/validator/file.php b/ipf/orm/validator/file.php new file mode 100644 index 0000000..b235643 --- /dev/null +++ b/ipf/orm/validator/file.php @@ -0,0 +1,8 @@ +