X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Generator.php;h=7ffeb57b856b59713a431cae841142b4762957d7;hp=9fdde2a199e429cff0a0b6331c69ab4de8c87c51;hb=443623f47935eb52acd65a3ff0d84eab1fd5a98b;hpb=b981a21a2d301a9f4707d6e3b7acaf82ecf1dbdf diff --git a/Generator.php b/Generator.php index 9fdde2a1..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; } @@ -167,7 +180,7 @@ class Pman_Core_Generator extends DB_DataObject_Generator if (!file_exists($tg) || !filesize($tg) ) { - if ($cli && file_exists($tg) || in_array($f, $flist)) { + if ($cli && file_exists($tg) || in_array($f, $flist) || in_array('_all_', $flist )) { echo "COPY $src $tg" . ($cli ? "\n" : "
"); copy($src, $tg); 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_'. ucfirst($this->table); // replace odd chars? + $this->classname = 'Pman_'.$mod . '_DataObjects_'. $clean_table; // replace odd chars? - $outfilename = $rd.'/'.$mod.'/'. ucfirst($this->table).'.php'; - $orig = $ff->page->rootDir .'/Pman/'.$mod.'/DataObjects/'. ucfirst($this->table).'.php'; + $outfilename = $rd.'/'.$mod.'/'. $clean_table .'.php'; + $orig = $ff->page->rootDir .'/Pman/'.$mod.'/DataObjects/'. $clean_table.'.php'; // file_get_contents???