php7 fixes
[Pman.Builder] / FormToSQL.php
index 3d6b539..835ee30 100644 (file)
@@ -14,7 +14,7 @@ class Pman_Builder_FormToSQL extends Pman {
         return true;
     }
     
-    function get()
+    function get($base, $opts = array())
     {
         //print_R($_SERVER['argv']);exit;
         $file  = $_SERVER['argv'][2];
@@ -29,22 +29,24 @@ class Pman_Builder_FormToSQL extends Pman {
         array_pop($b);
         $tn = strtolower(preg_replace('/([A-Z])/','_$1', array_pop($b)));
         $tn = preg_replace('/^_+/', '', $tn);
-        $this->toSQL($tn);
-        $b= basename(dirname($file));
         if (!empty($_SERVER['argv'][3])) {
-            $b= $_SERVER['argv'][3];
+            $tn= $_SERVER['argv'][3];
         }
         
+        
+        $this->toSQL($tn);
+        $b= basename(dirname($file));
+        
         $do = $this->toDO($b, $tn);
         
-        $dofile = dirname($file).'/DataObjects/'.ucfirst($b).'.php';
+        $dofile = dirname($file).'/DataObjects/'. ucfirst($tn).'.php';
         if (!file_exists($dofile)) {
             echo "WRITING  $dofile\n";
             file_put_contents($dofile, $do);
         } else {
-            
+            // should support AUTOCODE...
             echo "DELETE $dofile IF YOU WANT TO RECREATED IT..\n";
-           }
+        }
         
         die("DONE");
     }
@@ -137,7 +139,7 @@ class Pman_Builder_FormToSQL extends Pman {
                     $f->type = $type;
                     $f->size = $len;
                     $this->cols[] = $f;
-                    continue;
+                    break;
                 }
                 // otherwise it's a datasource based one...
                 // our 18N fields are a bit odd here...
@@ -147,7 +149,7 @@ class Pman_Builder_FormToSQL extends Pman {
                     $f->size = 8;
                     $f->default = "''";
                     $this->cols[] = $f;
-                    continue;
+                    break;
                 }
                 $f->name = isset($o->hiddenName) ? $o->hiddenName : $o->name; 
                 $f->type = 'INT';
@@ -155,14 +157,14 @@ class Pman_Builder_FormToSQL extends Pman {
                 $f->extra = "NOT NULL";
                 $f->default = 0;
                 $this->cols[] = $f;
-                continue;
+                break;
             
             case 'TextArea':
                 $f->name = $o->name;
                 $f->type = 'TEXT';
                 
                 $this->cols[] = $f;
-                continue;
+                break;
             
             case 'DateField':
             case 'NumberField':
@@ -184,7 +186,7 @@ class Pman_Builder_FormToSQL extends Pman {
                 array_unshift($this->cols, $f); 
                 break;
             default:
-                continue;
+                break;
             
         }