Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing baking views for models in plugins. Making sure that the tempo…
…rary controller object gets its plugin property set so the correct models are loaded and used. Fixes #381
  • Loading branch information
markstory committed Feb 28, 2010
1 parent ec5d972 commit 748ec4e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cake/console/libs/tasks/view.php
Expand Up @@ -289,9 +289,10 @@ function __loadController() {
}
$controllerClassName = $this->controllerName . 'Controller';
$controllerObj =& new $controllerClassName();
$controllerObj->plugin = $this->plugin;
$controllerObj->constructClasses();
$modelClass = $controllerObj->modelClass;
$modelObj =& ClassRegistry::getObject($controllerObj->modelKey);
$modelObj =& $controllerObj->{$controllerObj->modelClass};

if ($modelObj) {
$primaryKey = $modelObj->primaryKey;
Expand All @@ -302,13 +303,10 @@ function __loadController() {
$fields = array_keys($schema);
$associations = $this->__associations($modelObj);
} else {
$primaryKey = null;
$displayField = null;
$primaryKey = $displayField = null;
$singularVar = Inflector::variable(Inflector::singularize($this->controllerName));
$singularHumanName = $this->_singularHumanName($this->controllerName);
$fields = array();
$schema = array();
$associations = array();
$fields = $schema = $associations = array();
}
$pluralVar = Inflector::variable($this->controllerName);
$pluralHumanName = $this->_pluralHumanName($this->controllerName);
Expand Down

0 comments on commit 748ec4e

Please sign in to comment.