summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newclass.php')
-rwxr-xr-xnewclass.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/newclass.php b/newclass.php
index f942416..75d20df 100755
--- a/newclass.php
+++ b/newclass.php
@@ -57,9 +57,20 @@ if (!$tables) {
}
echo 'Generating classes for table(s): '.implode(', ', $tables)."\n";
foreach ($tables as $table) {
- $default=rtrim($table, 's');
+ $default='sql_';
+ if (substr($table, -1) == 's') {
+ $default.=substr($table, 0, strlen($table)-1);
+ } else {
+ $default.=$table;
+ }
$class=prompt_string('Class name for table '.$table.':', $default);
- $file=SHARED.'/classes/'.prompt_string('Filename for class '.$class.': '.SHARED.'/classes/', $class.'.php');
+ if (substr($class, 0, 4) == 'sql_') {
+ $default=substr($class, 4);
+ } else {
+ $default=$class;
+ }
+ $default.='.php';
+ $file=SHARED.'/classes/'.prompt_string('Filename for class '.$class.': '.SHARED.'/classes/', $default);
if (is_file($file)) {
if (!prompt_bool($file.' exists. Overwrite?', false)) {
echo 'Skipping table '.$table."\n";