diff --git a/cake/scripts/bake.php b/cake/scripts/bake.php index 858994545..9e1f8104a 100644 --- a/cake/scripts/bake.php +++ b/cake/scripts/bake.php @@ -559,6 +559,7 @@ class Bake { $this->stdout('View Bake:'); $this->hr(); $uses = array(); + $wannaUseSession = 'y'; $wannaDoScaffold = 'y'; $controllerName = ''; $inflect = new Inflector(); @@ -583,8 +584,11 @@ class Bake { $file = CONTROLLERS . $controllerName . '_controller.php'; if(!file_exists($file)) { + $shortPath = str_replace(ROOT, null, $file); + $shortPath = str_replace('../', '', $shortPath); + $shortPath = str_replace('//', '/', $shortPath); $this->stdout(''); - $this->stdout("The file '$file' could not be found.\nIn order to scaffold, you'll need to first create the controller. "); + $this->stdout("The file '$shortPath' could not be found.\nIn order to scaffold, you'll need to first create the controller. "); $this->stdout(''); die(); } else { @@ -608,8 +612,8 @@ class Bake { $alias[] = $key; } } - $indexView .= "
Actions | \n"; $indexView .= "||||||
---|---|---|---|---|---|---|
link(\$row['" . $alias[$count] ."']['" . $otherModelObject->getDisplayField() ."'], '/" . $inflect->pluralize($inflect->underscore(strtolower($alias[$count]))) ."/view/' .\$row['{$alias[$count]}']['{$otherModelObject->primaryKey}']);?> | \n"; + $indexView .= "\tlink(\$".$inflect->singularize($this->lowCtrl)."['" . $alias[$count] ."']['" . $otherModelObject->getDisplayField() ."'], '/" . $inflect->pluralize($inflect->underscore(strtolower($alias[$count]))) ."/view/' .\$".$inflect->singularize($this->lowCtrl)."['{$alias[$count]}']['{$otherModelObject->primaryKey}']);?> | \n"; } else { - $indexView .= "\t\n"; + $indexView .= "\t | singularize($this->lowCtrl)."['" . $alias[$count] ."']['" . $field ."'] ?> | \n"; } $count++; } else { - $indexView .= "\tmodelClass}']['{$field}'] ?> | \n"; + $indexView .= "\tsingularize($this->lowCtrl)."['{$temp->modelClass}']['{$field}'] ?> | \n"; } } $id = $temp->{$temp->modelClass}->primaryKey; $indexView .= "\t\n"; - $indexView .= "\t\tlink('View','/$temp->viewPath/view/' . \$row['{$temp->modelClass}']['$id'])?>\n"; - $indexView .= "\t\tlink('Edit','/$temp->viewPath/edit/' . \$row['{$temp->modelClass}']['$id'])?>\n"; - $indexView .= "\t\tlink('Delete','/$temp->viewPath/delete/' . \$row['{$temp->modelClass}']['$id'], null, 'Are you sure you want to delete: id ' . \$row['{$temp->modelClass}']['$id'])?>\n"; + $indexView .= "\t\tlink('View','/$temp->viewPath/view/' . \$".$inflect->singularize($this->lowCtrl)."['{$temp->modelClass}']['$id'])?>\n"; + $indexView .= "\t\tlink('Edit','/$temp->viewPath/edit/' . \$".$inflect->singularize($this->lowCtrl)."['{$temp->modelClass}']['$id'])?>\n"; + $indexView .= "\t\tlink('Delete','/$temp->viewPath/delete/' . \$".$inflect->singularize($this->lowCtrl)."['{$temp->modelClass}']['$id'], null, 'Are you sure you want to delete: id ' . \$".$inflect->singularize($this->lowCtrl)."['{$temp->modelClass}']['$id'])?>\n"; $indexView .= "\t | \n"; $indexView .= "