Permalink
Browse files

Adding `cake bake view all`

  • Loading branch information...
1 parent 73b9cbf commit 1291d4f02527e82fdaa3eac19cf88aa79fb06214 @markstory markstory committed Apr 28, 2009
Showing with 28 additions and 0 deletions.
  1. +28 −0 cake/console/libs/tasks/view.php
View
28 cake/console/libs/tasks/view.php
@@ -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);
@@ -147,6 +151,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
*
* @access private

0 comments on commit 1291d4f

Please sign in to comment.