mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fixing baking views for models in plugins. Making sure that the temporary controller object gets its plugin property set so the correct models are loaded and used. Fixes #381
This commit is contained in:
parent
ec5d9729b0
commit
748ec4ee78
1 changed files with 4 additions and 6 deletions
|
@ -289,9 +289,10 @@ class ViewTask extends Shell {
|
|||
}
|
||||
$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 @@ class ViewTask extends Shell {
|
|||
$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);
|
||||
|
|
Loading…
Add table
Reference in a new issue