Skip to content
Permalink
Browse files

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 748ec4ee78ff3bc0e4c7bfa5fa94e3ffb927d3a9
Showing with 4 additions and 6 deletions.
  1. +4 −6 cake/console/libs/tasks/view.php
@@ -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;
@@ -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);

0 comments on commit 748ec4e

Please sign in to comment.
You can’t perform that action at this time.