Merging changes to bake

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3297 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-07-23 19:06:21 +00:00
parent e2937c405e
commit aee87dcdda

View file

@ -705,6 +705,7 @@ class Bake {
foreach($relations as $association => $relation) { foreach($relations as $association => $relation) {
$model = $relation['className']; $model = $relation['className'];
$associationModel = new $model();
$count = 0; $count = 0;
$otherModelName = $inflect->singularize($model); $otherModelName = $inflect->singularize($model);
$controller = $inflect->pluralize($model); $controller = $inflect->pluralize($model);
@ -722,19 +723,11 @@ class Bake {
$viewView .= "\t<?php foreach(\$row as \$column => \$value):?>\n"; $viewView .= "\t<?php foreach(\$row as \$column => \$value):?>\n";
$viewView .= "\t\t<td><?php echo \$value?></td>\n"; $viewView .= "\t\t<td><?php echo \$value?></td>\n";
$viewView .= "\t<?php endforeach;?>\n"; $viewView .= "\t<?php endforeach;?>\n";
$viewView .= "<?php if (isset(\$this->controller->{$modelName}->{$association})):?>\n"; $viewView .= "\t<td>\n";
$viewView .= "<td>\n"; $viewView .= "\t\t<?php echo \$html->link('View', '/" . $inflect->underscore($controller) . "/view/' . \$row['{$associationModel->primaryKey}'])?>\n";
$viewView .= "\t<?php echo \$html->link('View', '/" . $inflect->underscore($controller) . "/view/' . \$row[\$this->controller->{$modelName}->{$association}->primaryKey])?>\n"; $viewView .= "\t\t<?php echo \$html->link('Edit', '/" . $inflect->underscore($controller) . "/edit/' . \$row['{$associationModel->primaryKey}'])?>\n";
$viewView .= "\t<?php echo \$html->link('Edit', '/" . $inflect->underscore($controller) . "/edit/' . \$row[\$this->controller->{$modelName}->{$association}->primaryKey])?>\n"; $viewView .= "\t\t<?php echo \$html->link('Delete', '/" . $inflect->underscore($controller) . "/delete/' . \$row['{$associationModel->primaryKey}'], null, 'Are you sure you want to delete: id ' . \$row[\$this->controller->{$modelName}->{$association}->primaryKey] . '?')?>\n";
$viewView .= "\t<?php echo \$html->link('Delete', '/" . $inflect->underscore($controller) . "/delete/' . \$row[\$this->controller->{$modelName}->{$association}->primaryKey], null, 'Are you sure you want to delete: id ' . \$row[\$this->controller->{$modelName}->{$association}->primaryKey] . '?')?>\n"; $viewView .= "\t</td>\n";
$viewView .= "</td>\n";
$viewView .= "<?php else: ?>\n";
$viewView .= "<td>\n";
$viewView .= "\t<?php echo \$html->link('View', '/" . $inflect->underscore($controller) . "/view/' . \$row[\$this->controller->{$modelName}->primaryKey])?>\n";
$viewView .= "\t<?php echo \$html->link('Edit', '/" . $inflect->underscore($controller) . "/edit/' . \$row[\$this->controller->{$modelName}->primaryKey])?>\n";
$viewView .= "\t<?php echo \$html->link('Delete', '/" . $inflect->underscore($controller) . "/delete/' . \$row[\$this->controller->{$modelName}->primaryKey], null, 'Are you sure you want to delete: id ' . \$row[\$this->controller->{$modelName}->primaryKey] . '?')?>\n";
$viewView .= "</td>\n";
$viewView .= "<?php endif; ?>\n";
$viewView .= "</tr>\n"; $viewView .= "</tr>\n";
$viewView .= "<?php endforeach; ?>\n"; $viewView .= "<?php endforeach; ?>\n";
$viewView .= "</table>\n"; $viewView .= "</table>\n";