fix bug in model names

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4087 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2006-12-08 16:20:42 +00:00
parent 2bab8c5f57
commit d67977bba0

View file

@ -901,11 +901,6 @@ class Bake {
//-------------------------[INDEX]-------------------------// //-------------------------[INDEX]-------------------------//
$indexView = null; $indexView = null;
if(!empty($modelObj->alias)) {
foreach ($modelObj->alias as $key => $value) {
$alias[] = $key;
}
}
$indexView .= "<div class=\"{$pluralName}\">\n"; $indexView .= "<div class=\"{$pluralName}\">\n";
$indexView .= "<h2>List " . $pluralHumanName . "</h2>\n\n"; $indexView .= "<h2>List " . $pluralHumanName . "</h2>\n\n";
$indexView .= "<table cellpadding=\"0\" cellspacing=\"0\">\n"; $indexView .= "<table cellpadding=\"0\" cellspacing=\"0\">\n";
@ -928,7 +923,7 @@ class Bake {
$otherControllerPath = $this->__controllerPath($otherControllerName); $otherControllerPath = $this->__controllerPath($otherControllerName);
if(is_object($otherModelObj)) { if(is_object($otherModelObj)) {
$displayField = $otherModelObj->getDisplayField(); $displayField = $otherModelObj->getDisplayField();
$indexView .= "\t<td>&nbsp;<?php echo \$html->link(\$".$singularName."['{$alias[$count]}']['{$displayField}'], '{$admin_url}/" . $otherControllerPath . "/view/' .\$".$singularName."['{$alias[$count]}']['{$otherModelObj->primaryKey}'])?></td>\n"; $indexView .= "\t<td>&nbsp;<?php echo \$html->link(\$".$singularName."['{$otherModelName}']['{$displayField}'], '{$admin_url}/" . $otherControllerPath . "/view/' .\$".$singularName."['{$otherModelName}']['{$otherModelObj->primaryKey}'])?></td>\n";
} else { } else {
$indexView .= "\t<td><?php echo \$".$singularName."['{$modelObj->name}']['{$field}']; ?></td>\n"; $indexView .= "\t<td><?php echo \$".$singularName."['{$modelObj->name}']['{$field}']; ?></td>\n";
} }
@ -958,7 +953,7 @@ class Bake {
$viewView .= "<dl>\n"; $viewView .= "<dl>\n";
$count = 0; $count = 0;
foreach($fieldNames as $field => $value) { foreach($fieldNames as $field => $value) {
$viewView .= "\t<dt>" . $value['prompt'] . "</dt>\n"; $viewView .= "\t<dt>" . $value['label'] . "</dt>\n";
if(isset($value['foreignKey'])) { if(isset($value['foreignKey'])) {
$otherModelName = $this->__modelName($value['model']); $otherModelName = $this->__modelName($value['model']);
$otherModelKey = Inflector::underscore($value['modelKey']); $otherModelKey = Inflector::underscore($value['modelKey']);
@ -966,7 +961,7 @@ class Bake {
$otherControllerName = $this->__controllerName($value['modelKey']); $otherControllerName = $this->__controllerName($value['modelKey']);
$otherControllerPath = $this->__controllerPath($otherControllerName); $otherControllerPath = $this->__controllerPath($otherControllerName);
$displayField = $otherModelObj->getDisplayField(); $displayField = $otherModelObj->getDisplayField();
$viewView .= "\t<dd>&nbsp;<?php echo \$html->link(\$".$singularName."['{$alias[$count]}']['{$displayField}'], '{$admin_url}/" . $otherControllerPath . "/view/' .\$".$singularName."['{$alias[$count]}']['{$otherModelObj->primaryKey}'])?></dd>\n"; $viewView .= "\t<dd>&nbsp;<?php echo \$html->link(\$".$singularName."['{$otherModelName}']['{$displayField}'], '{$admin_url}/" . $otherControllerPath . "/view/' .\$".$singularName."['{$otherModelName}']['{$otherModelObj->primaryKey}'])?></dd>\n";
$count++; $count++;
} else { } else {
$viewView .= "\t<dd>&nbsp;<?php echo \$".$singularName."['{$modelObj->name}']['{$field}']?></dd>\n"; $viewView .= "\t<dd>&nbsp;<?php echo \$".$singularName."['{$modelObj->name}']['{$field}']?></dd>\n";