mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
0d373a0c16
commit
49e58cec49
3 changed files with 91 additions and 89 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -791,6 +791,8 @@ class ModelTest extends CakeTestCase {
|
|||
);
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
debug($result);
|
||||
debug($expected);
|
||||
}
|
||||
|
||||
function testSaveField() {
|
||||
|
|
Loading…
Add table
Reference in a new issue