return true;
}
- function get()
+ function get($base, $opts = array())
{
//print_R($_SERVER['argv']);exit;
$file = $_SERVER['argv'][2];
array_pop($b);
$tn = strtolower(preg_replace('/([A-Z])/','_$1', array_pop($b)));
$tn = preg_replace('/^_+/', '', $tn);
+ if (!empty($_SERVER['argv'][3])) {
+ $tn= $_SERVER['argv'][3];
+ }
+
+
$this->toSQL($tn);
$b= basename(dirname($file));
- $this->toDO($b, $tn);
+
+ $do = $this->toDO($b, $tn);
+
+ $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");
}
require_once \'DB/DataObject.php\';
';
- $out.="class Pman_$b_DataObjects_$utn extends DB_DataObject
+ $out.="class Pman_{$b}_DataObjects_$utn extends DB_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
public \$__table = '$tn'; // table name
";
foreach($this->cols as $f) {
- $out .= ' public $' . str_pad($f->name,30 ). '// ' . $f->def;
+ $out .= ' public $' . str_pad($f->name.';',30 ). '// ' . $f->def . "\n";
}
$out.="
}";
-
+ echo "\n\n";
echo $out;
+ echo "\n\n";
+ return $out;
}
}
\ No newline at end of file