]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
File Uploads & Ready for first project
authoravl <alex.litovchenko@gmail.com>
Thu, 21 Aug 2008 03:44:29 +0000 (06:44 +0300)
committeravl <alex.litovchenko@gmail.com>
Thu, 21 Aug 2008 03:44:29 +0000 (06:44 +0300)
ipf/orm/record.php
ipf/orm/table.php
ipf/orm/utils.php
ipf/orm/validator/file.php [new file with mode: 0644]
ipf/orm/validator/image.php [new file with mode: 0644]

index 7b2b03c4f390d733e351eaf899ca802085c7c5b4..fd81dcc7381baa6a7f901adb8b7294acc7ee27c0 100644 (file)
@@ -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
index 6403fa819d0eb1233c54b1cf6a277088991f296f..9f00d7bb9f4aedd86121fdf2dc1bd97f2c53d7aa 100644 (file)
@@ -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'
index 5afd7da09234f72d0442f9f4436bec18afbfec96..5664c70d1ce711743b28dba263e15a70c6a83fb5 100644 (file)
@@ -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 (file)
index 0000000..b235643
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+class IPF_ORM_Validator_File
+{
+    public function validate($value){
+        return true;
+    }
+}
\ No newline at end of file
diff --git a/ipf/orm/validator/image.php b/ipf/orm/validator/image.php
new file mode 100644 (file)
index 0000000..fb2e1e8
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+class IPF_ORM_Validator_Image
+{
+    public function validate($value){
+        return true;
+    }
+}
\ No newline at end of file