mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
fixing some errors in bake view task when no model schema is available
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6566 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
360b91eea7
commit
3a67bdc06d
1 changed files with 21 additions and 8 deletions
|
@ -253,14 +253,26 @@ class ViewTask extends Shell {
|
||||||
$controllerObj->constructClasses();
|
$controllerObj->constructClasses();
|
||||||
$modelClass = $controllerObj->modelClass;
|
$modelClass = $controllerObj->modelClass;
|
||||||
$modelObj =& ClassRegistry::getObject($controllerObj->modelKey);
|
$modelObj =& ClassRegistry::getObject($controllerObj->modelKey);
|
||||||
$primaryKey = $modelObj->primaryKey;
|
|
||||||
$displayField = $modelObj->displayField;
|
if ($modelObj) {
|
||||||
$singularVar = Inflector::variable($modelClass);
|
$primaryKey = $modelObj->primaryKey;
|
||||||
$pluralVar = Inflector::variable($this->controllerName);
|
$displayField = $modelObj->displayField;
|
||||||
$singularHumanName = Inflector::humanize($modelClass);
|
$singularVar = Inflector::variable($modelClass);
|
||||||
$pluralHumanName = Inflector::humanize($this->controllerName);
|
$pluralVar = Inflector::variable($this->controllerName);
|
||||||
$fields = array_keys($modelObj->schema());
|
$singularHumanName = Inflector::humanize($modelClass);
|
||||||
$associations = $this->__associations($modelObj);
|
$pluralHumanName = Inflector::humanize($this->controllerName);
|
||||||
|
$fields = array_keys($modelObj->schema());
|
||||||
|
$associations = $this->__associations($modelObj);
|
||||||
|
} else {
|
||||||
|
$primaryKey = null;
|
||||||
|
$displayField = null;
|
||||||
|
$singularVar = Inflector::variable(Inflector::singularize($this->controllerName));
|
||||||
|
$pluralVar = Inflector::variable($this->controllerName);
|
||||||
|
$singularHumanName = Inflector::humanize(Inflector::singularize($this->controllerName));
|
||||||
|
$pluralHumanName = Inflector::humanize($this->controllerName);
|
||||||
|
$fields = array();
|
||||||
|
$associations = array();
|
||||||
|
}
|
||||||
|
|
||||||
return compact('modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
|
return compact('modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
|
||||||
'singularHumanName', 'pluralHumanName', 'fields','associations');
|
'singularHumanName', 'pluralHumanName', 'fields','associations');
|
||||||
|
@ -331,6 +343,7 @@ class ViewTask extends Shell {
|
||||||
$content = ob_get_clean();
|
$content = ob_get_clean();
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
$this->hr();
|
||||||
$this->err(sprintf(__('Template for %s could not be found', true), $template));
|
$this->err(sprintf(__('Template for %s could not be found', true), $template));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue