updating scaffold, fixes #3367

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5734 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-10-08 19:58:56 +00:00
parent 356fd587cd
commit 8fbcfe5239

View file

@ -303,15 +303,12 @@ class Scaffold extends Object {
}
foreach ($this->ScaffoldModel->belongsTo as $assocName => $assocData) {
$varName = $assocName;
if($this->ScaffoldModel->name == $assocData['className']) {
$varName = $assocData['className'];
}
$this->controller->set(Inflector::pluralize(Inflector::variable($varName)), $this->ScaffoldModel->{$assocName}->generateList());
$varName = Inflector::variable(Inflector::pluralize(preg_replace('/_id$/', '', $assocData['foreignKey'])));
$this->controller->set($varName, $this->ScaffoldModel->{$assocName}->generateList());
}
foreach($this->ScaffoldModel->hasAndBelongsToMany as $assocName => $assocData) {
$this->controller->set(Inflector::pluralize(Inflector::variable($varName)), $this->ScaffoldModel->{$assocName}->generateList());
foreach ($this->ScaffoldModel->hasAndBelongsToMany as $assocName => $assocData) {
$varName = Inflector::variable(Inflector::pluralize($assocName));
$this->controller->set($varName, $this->ScaffoldModel->{$assocName}->generateList());
}
return $this->__scaffoldForm($formAction);