Adding fix for scaffold when using self associated HABTM

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4759 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-04-04 17:25:18 +00:00
parent 0d373a0c16
commit 49e58cec49
3 changed files with 91 additions and 89 deletions

View file

@ -812,17 +812,17 @@ class Controller extends Object {
$otherModelKey = Inflector::underscore($assocData['className']);
$otherModelObj = &ClassRegistry::getObject($otherModelKey);
if ($doCreateOptions) {
$fieldNames[$otherModelKey]['model'] = $associationName;
$fieldNames[$otherModelKey]['label'] = "Related " . Inflector::humanize(Inflector::pluralize($associationName));
$fieldNames[$otherModelKey]['prompt'] = $fieldNames[$otherModelKey]['label'];
$fieldNames[$otherModelKey]['type'] = "select";
$fieldNames[$otherModelKey]['multiple'] = "multiple";
$fieldNames[$otherModelKey]['tagName'] = $associationName . '/' . $associationName;
$fieldNames[$otherModelKey]['name'] = $associationName;
$fieldNames[$otherModelKey]['class'] = 'optional';
$fieldNames[$otherModelKey]['options'] = $otherModelObj->generateList();
$fieldNames[$associationName]['model'] = $associationName;
$fieldNames[$associationName]['label'] = "Related " . Inflector::humanize(Inflector::pluralize($associationName));
$fieldNames[$associationName]['prompt'] = $fieldNames[$associationName]['label'];
$fieldNames[$associationName]['type'] = "select";
$fieldNames[$associationName]['multiple'] = "multiple";
$fieldNames[$associationName]['tagName'] = $associationName . '/' . $associationName;
$fieldNames[$associationName]['name'] = $associationName;
$fieldNames[$associationName]['class'] = 'optional';
$fieldNames[$associationName]['options'] = $otherModelObj->generateList();
if (isset($data[$associationName])) {
$fieldNames[$otherModelKey]['selected'] = $this->_selectedArray($data[$associationName], $otherModelObj->primaryKey);
$fieldNames[$associationName]['selected'] = $this->_selectedArray($data[$associationName], $otherModelObj->primaryKey);
}
}
}

View file

@ -791,6 +791,8 @@ class ModelTest extends CakeTestCase {
);
$this->assertEqual($result, $expected);
debug($result);
debug($expected);
}
function testSaveField() {