Skip to content

Commit

Permalink
Adding cake bake view all
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Apr 28, 2009
1 parent 73b9cbf commit 1291d4f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions cake/console/libs/tasks/view.php
Expand Up @@ -114,6 +114,10 @@ function execute() {
if (!$action) {
$action = $this->template;
}

if (strtolower($this->args[0]) == 'all') {
return $this->all();
}

if (in_array($action, $this->scaffoldActions)) {
$this->bake($action, true);
Expand Down Expand Up @@ -146,6 +150,30 @@ function execute() {
}
}
}
/**
* Bake All views for All controllers.
*
* @return void
**/
function all() {
$ds = 'default';
$actions = $this->scaffoldActions;
$tables = $this->Controller->listAll($ds, false);
foreach ($tables as $table) {
$model = $this->_modelName($table);
$this->controllerName = $this->_controllerName($model);
$this->controllerPath = Inflector::underscore($this->controllerName);
if (App::import('Model', $model)) {
$vars = $this->__loadController();
if ($vars) {
foreach ($actions as $action) {
$content = $this->getContent($action, $vars);
$this->bake($action, $content);
}
}
}
}
}
/**
* Handles interactive baking
*
Expand Down

0 comments on commit 1291d4f

Please sign in to comment.