X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Generator.php;h=7ffeb57b856b59713a431cae841142b4762957d7;hp=36e9fa82f1f270b4ad717fead42cd0c4bedd46cf;hb=443623f47935eb52acd65a3ff0d84eab1fd5a98b;hpb=d023eb369a54cd769534d1e32190368b871667f6 diff --git a/Generator.php b/Generator.php index 36e9fa82..7ffeb57b 100644 --- a/Generator.php +++ b/Generator.php @@ -2,6 +2,9 @@ /** + * + * THIS HAS NOT BEEN TESTED WITH PDO yet... + * * * Generate DataObjects... * @@ -12,7 +15,7 @@ * */ -require_once 'DB/DataObject/Generator.php'; +require_once 'PDO/DataObject/Generator.php'; /** basic thing now works... @@ -42,10 +45,16 @@ $this->def['forms'][$table][$t->name] = $form; -class Pman_Core_Generator extends DB_DataObject_Generator +class Pman_Core_Generator extends PDO_DataObject_Generator { - + + function getAuth() + { + + die("do not use this directly.. - use Core/RunGenerator"); + + } // inherrited.. // $tablekeys @@ -108,6 +117,7 @@ class Pman_Core_Generator extends DB_DataObject_Generator $options['class_location'] = $this->rootDir .'/'.$proj.'/DataObjects'; $options['require_prefix'] = $proj . '/DataObjects/'; $options['class_prefix'] = $proj . '_DataObjects_'; + $this->debug(print_r($options,true)); // print_r($this);exit; @@ -155,6 +165,9 @@ class Pman_Core_Generator extends DB_DataObject_Generator continue; } foreach(scandir($options['rootDir'].'/'.$m) as $f) { + + echo "SCAN {$options['rootDir']} $f\n"; + if (!strlen($f) || $f[0] == '.') { continue; } @@ -347,6 +360,7 @@ touch Pman/????/DataObjects/".ucfirst($this->table).".php $cli = $options['cli']; foreach($this->tables as $this->table) { + $this->table = trim($this->table); $tn = strtolower($this->table); $mod = $this->modmap[$tn]; @@ -355,12 +369,13 @@ touch Pman/????/DataObjects/".ucfirst($this->table).".php continue; } + $clean_table = preg_replace('/[^A-Z0-9]+/i','_',ucfirst(trim($this->table))); - $this->classname = 'Pman_'.$mod . '_DataObjects_'. preg_replace('/[^A-Z0-9]+/i','_',ucfirst(trim($this->table)));; // replace odd chars? + $this->classname = 'Pman_'.$mod . '_DataObjects_'. $clean_table; // replace odd chars? - $outfilename = $rd.'/'.$mod.'/'. preg_replace('/[^A-Z0-9]+/i','_',ucfirst(trim($this->table)));'.php'; - $orig = $ff->page->rootDir .'/Pman/'.$mod.'/DataObjects/'. preg_replace('/[^A-Z0-9]+/i','_',ucfirst(trim($this->table)));.'.php'; + $outfilename = $rd.'/'.$mod.'/'. $clean_table .'.php'; + $orig = $ff->page->rootDir .'/Pman/'.$mod.'/DataObjects/'. $clean_table.'.php'; // file_get_contents???