From aee87dcdda2d1dc4433f0553c1ff671deb12b336 Mon Sep 17 00:00:00 2001 From: phpnut Date: Sun, 23 Jul 2006 19:06:21 +0000 Subject: [PATCH] Merging changes to bake git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3297 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/scripts/bake.php | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/cake/scripts/bake.php b/cake/scripts/bake.php index db0ddba95..a9bae9639 100644 --- a/cake/scripts/bake.php +++ b/cake/scripts/bake.php @@ -704,7 +704,8 @@ class Bake { $relations = array_merge($objModel->hasMany, $objModel->hasAndBelongsToMany); foreach($relations as $association => $relation) { - $model = $relation['className']; + $model = $relation['className']; + $associationModel = new $model(); $count = 0; $otherModelName = $inflect->singularize($model); $controller = $inflect->pluralize($model); @@ -722,19 +723,11 @@ class Bake { $viewView .= "\t \$value):?>\n"; $viewView .= "\t\t\n"; $viewView .= "\t\n"; - $viewView .= "controller->{$modelName}->{$association})):?>\n"; - $viewView .= "\n"; - $viewView .= "\tlink('View', '/" . $inflect->underscore($controller) . "/view/' . \$row[\$this->controller->{$modelName}->{$association}->primaryKey])?>\n"; - $viewView .= "\tlink('Edit', '/" . $inflect->underscore($controller) . "/edit/' . \$row[\$this->controller->{$modelName}->{$association}->primaryKey])?>\n"; - $viewView .= "\tlink('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 .= "\n"; - $viewView .= "\n"; - $viewView .= "\n"; - $viewView .= "\tlink('View', '/" . $inflect->underscore($controller) . "/view/' . \$row[\$this->controller->{$modelName}->primaryKey])?>\n"; - $viewView .= "\tlink('Edit', '/" . $inflect->underscore($controller) . "/edit/' . \$row[\$this->controller->{$modelName}->primaryKey])?>\n"; - $viewView .= "\tlink('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 .= "\n"; - $viewView .= "\n"; + $viewView .= "\t\n"; + $viewView .= "\t\tlink('View', '/" . $inflect->underscore($controller) . "/view/' . \$row['{$associationModel->primaryKey}'])?>\n"; + $viewView .= "\t\tlink('Edit', '/" . $inflect->underscore($controller) . "/edit/' . \$row['{$associationModel->primaryKey}'])?>\n"; + $viewView .= "\t\tlink('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\n"; $viewView .= "\n"; $viewView .= "\n"; $viewView .= "\n"; @@ -1001,7 +994,7 @@ class Bake { $actions .= "\t\t}\n"; $actions .= "\t}\n"; $actions .= "\n"; - $actions .= "\tfunction view(\$id) {\n"; + $actions .= "\tfunction view(\$id) {\n"; $actions .= "\t\t\$this->set('{$this->lowCtrl}', \$this->{$controllerModel}->read(null, \$id));\n"; $actions .= "\t}\n"; $actions .= "\n"; @@ -1508,7 +1501,7 @@ class Bake { } switch( $field['type'] ) { - case "input" : + case "input" : if(!isset( $field['size'])) { $field['size'] = 60; }