Initializing tasks before execution (ticket #2725)

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5256 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
dho 2007-06-07 13:09:59 +00:00
parent 22ca7f3f3b
commit eea7d7aafc

View file

@ -59,15 +59,15 @@ class BakeShell extends Shell {
switch($classToBake) { switch($classToBake) {
case 'M': case 'M':
$invalidSelection = false; $invalidSelection = false;
$this->Model->execute(); $this->__executeTask($this->Model);
break; break;
case 'V': case 'V':
$invalidSelection = false; $invalidSelection = false;
$this->View->execute(); $this->__executeTask($this->View);
break; break;
case 'C': case 'C':
$invalidSelection = false; $invalidSelection = false;
$this->Controller->execute(); $this->__executeTask($this->Controller);
break; break;
default: default:
$this->out('You have made an invalid selection. Please choose a type of class to Bake by entering M, V, or C.'); $this->out('You have made an invalid selection. Please choose a type of class to Bake by entering M, V, or C.');
@ -76,6 +76,13 @@ class BakeShell extends Shell {
$this->main(); $this->main();
} }
function __executeTask($task) {
$task->initialize();
$task->loadTasks();
$task->startup();
$task->execute();
}
function help() { function help() {
$this->out('CakePHP Bake:'); $this->out('CakePHP Bake:');
$this->hr(); $this->hr();