mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
updating baking of models
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5081 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
172492963e
commit
51e3ce02f6
1 changed files with 6 additions and 34 deletions
|
@ -49,27 +49,13 @@ class BakeShell extends Shell {
|
|||
var $interactive = false;
|
||||
|
||||
var $__modelAlias = false;
|
||||
/**
|
||||
* Private helper function for constructor
|
||||
* @access private
|
||||
*/
|
||||
function initialize() {
|
||||
$this->welcome();
|
||||
}
|
||||
|
||||
/**
|
||||
* Main-loop method.
|
||||
*
|
||||
*/
|
||||
function main() {
|
||||
|
||||
$this->out('');
|
||||
$this->out('');
|
||||
$this->out('Baking...');
|
||||
$this->hr();
|
||||
$this->out('Name: '. APP_DIR);
|
||||
$this->out('Path: '. ROOT . DS . APP_DIR);
|
||||
$this->hr();
|
||||
|
||||
|
||||
if(!is_dir(CONFIGS)) {
|
||||
$this->project($this->params['app']);
|
||||
}
|
||||
|
@ -81,10 +67,10 @@ class BakeShell extends Shell {
|
|||
}
|
||||
|
||||
$this->out('[M]odel');
|
||||
$this->out('[C]ontroller');
|
||||
$this->out('[V]iew');
|
||||
$this->out('[C]ontroller');
|
||||
|
||||
$invalidSelection = true;
|
||||
|
||||
while ($invalidSelection) {
|
||||
$classToBake = strtoupper($this->in('What would you like to Bake?', array('M', 'V', 'C')));
|
||||
switch($classToBake) {
|
||||
|
@ -259,7 +245,7 @@ class BakeShell extends Shell {
|
|||
}
|
||||
|
||||
$db =& ConnectionManager::getDataSource($useDbConfig);
|
||||
|
||||
$tableIsGood = false;
|
||||
$useTable = Inflector::tableize($currentModelName);
|
||||
$fullTableName = $db->fullTableName($useTable, false);
|
||||
if(array_search($useTable, $this->__tables) === false) {
|
||||
|
@ -270,7 +256,6 @@ class BakeShell extends Shell {
|
|||
if (low($tableIsGood) == 'n' || low($tableIsGood) == 'no') {
|
||||
$useTable = $this->in('What is the name of the table (enter "null" to use NO table)?');
|
||||
}
|
||||
$tableIsGood = false;
|
||||
while($tableIsGood == false && low($useTable) != 'null') {
|
||||
if (is_array($this->__tables) && !in_array($useTable, $this->__tables)) {
|
||||
$fullTableName = $db->fullTableName($useTable, false);
|
||||
|
@ -573,7 +558,7 @@ class BakeShell extends Shell {
|
|||
$this->out('The following model will be created:');
|
||||
$this->hr();
|
||||
$this->out("Model Name: $currentModelName");
|
||||
$this->out("DB Connection: " . ($usingDefault ? 'default' : $useDbConfig));
|
||||
$this->out("DB Connection: " . $useDbConfig);
|
||||
$this->out("DB Table: " . $fullTableName);
|
||||
if($primaryKey != 'id') {
|
||||
$this->out("Primary Key: " . $primaryKey);
|
||||
|
@ -1994,19 +1979,6 @@ class BakeShell extends Shell {
|
|||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Outputs an ASCII art banner to standard output.
|
||||
*
|
||||
*/
|
||||
function welcome()
|
||||
{
|
||||
$this->out('');
|
||||
$this->out(' ___ __ _ _ ___ __ _ _ __ __ __ _ _ ___ ');
|
||||
$this->out('| |__| |_/ |__ |__] |__| |__] |__] |__| |_/ |__ ');
|
||||
$this->out('|___ | | | \_ |___ | | | | |__] | | | \_ |___ ');
|
||||
$this->hr();
|
||||
$this->out('');
|
||||
}
|
||||
/**
|
||||
* Writes a file with a default home page to the project.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue