php7 fixes
[Pman.Builder] / Generator.php
index 3199f17..bd15eaf 100644 (file)
@@ -91,7 +91,9 @@ class Pman_Builder_Generator extends DB_DataObject_Generator
         
         $proj = 'pman'; //ucfirst(basename($options['database']));
         // we are going to generate all of the code into a temporay foldler..
-        $options['rootDir'] = ini_get('session.save_path').'/temp_'. $proj;
+        $user = posix_getpwuid(posix_getuid());
+        
+        $options['rootDir'] = ini_get('session.save_path').'/temp_'. $proj.'_'. $user['name'];
         $options['cli'] = $cli;
         $options['mods'] = empty($mods) ? array() : explode('/',$mods);
        
@@ -222,7 +224,8 @@ class Pman_Builder_Generator extends DB_DataObject_Generator
         require_once 'System.php';
         $cat = System::which('cat');
         $mysql = System::which('mysql');
-        print_r($options['mods'] );
+        //print_r($ff);
+        //print_r($options['mods'] );
         foreach($this->modsql as $m => $fl)
         {
             if ($cli && isset($options['database_'. $m])) {
@@ -329,6 +332,9 @@ class Pman_Builder_Generator extends DB_DataObject_Generator
             $this->scanModules();
         }
          $options = &PEAR::getStaticProperty('DB_DataObject','options');
+        $builder_options = PEAR::getStaticProperty('Pman_Builder','options');
+        $ignore = empty($builder_options['skip_tables']) ? array() : $builder_options['skip_tables'];
+        
          $mods = $options['mods'];
         $inis = array();
         $this->_newConfig = '';
@@ -336,12 +342,24 @@ class Pman_Builder_Generator extends DB_DataObject_Generator
             
             $tn  = strtolower($this->table);
             //print_r($this->modmap);//[$tn]);//
+            
+            
+            
             if (!isset($this->modmap[$tn])) {
-                die("No existing DataObject file found for table {$this->table} \n".
-                    "- create an empty file in the related Module/DataObjects directory
-                    eg. 
-                    touch Pman/????/DataObjects/".ucfirst($this->table).".php
-                   \n");
+                
+                if (in_array($this->table, $ignore)) {
+                    continue;
+                }
+             
+             
+                die("No existing DataObject file found for table {$this->table} 
+                
+- either add it to Pman_Builder[skip_tables] or\n
+- create an empty file in the related Module/DataObjects directory
+eg. 
+touch Pman/????/DataObjects/".ucfirst($this->table).".php
+
+");
                     
             }
             $mod = $this->modmap[$tn];
@@ -438,10 +456,16 @@ class Pman_Builder_Generator extends DB_DataObject_Generator
    // function generateClasses() { }
    
     var $jsHeader = "//<script type=\"text/javascript\">\n";
-        
+    /**
+     * 
+     * generate the reader tables.. 
+     * I'm not sure if this is needed any more, as our desktop builder 
+     * generates that data anyway.
+     * 
+     */
     function generateRoo()
     {
-         
+        
         $options = &PEAR::getStaticProperty('DB_DataObject','options');
          $mods = $options['mods'];
         $this->rootDir = $options['rootDir'];
@@ -486,8 +510,8 @@ class Pman_Builder_Generator extends DB_DataObject_Generator
     
     function _generateReaders($m)
     {
-         
-        $udb = ucfirst($this->_database);
+        $ff = HTML_FlexyFramework::get();
+        
         $ret = $this->jsHeader;
         $j = new Pman_Builder_Generator_JSON();
         $j->indent = 0;
@@ -511,7 +535,7 @@ class Pman_Builder_Generator extends DB_DataObject_Generator
                 }
             }
             $this->readersArgs[$this->table]['xtype'] = 'JsonReader';
-            $ret.="\n$udb.Readers.$utable = ";
+            $ret.="\n{$ff->project}.Readers.$utable = ";
             $x = $j->encodeUnsafe($this->readersArgs[$this->table]);
             $ret .=  trim(substr($x, 0, -1)) . ",\n"; // strip of trailing ;};
             $ret .=  $j->tab . "fields : [\n". $j->tab.$j->tab;