mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding Controller::_selectedArray().
Changed Bake to use _selectedArray instead of _ _selectedArray() git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3742 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
79a8944ba4
commit
12a6df23ef
2 changed files with 18 additions and 1 deletions
|
@ -1098,6 +1098,23 @@ class Controller extends Object {
|
||||||
function _scaffoldError($method) {
|
function _scaffoldError($method) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter description here...
|
||||||
|
*
|
||||||
|
* @param unknown_type $data
|
||||||
|
* @param unknown_type $key
|
||||||
|
* @return unknown
|
||||||
|
*/
|
||||||
|
function _selectedArray($data, $key = 'id') {
|
||||||
|
$array = array();
|
||||||
|
if(!empty($data)) {
|
||||||
|
foreach($data as $var) {
|
||||||
|
$array[$var[$key]] = $var[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -1414,7 +1414,7 @@ class Bake {
|
||||||
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
|
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
|
||||||
$actions .= "\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->{$otherModelName}->generateList());\n";
|
$actions .= "\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->{$otherModelName}->generateList());\n";
|
||||||
$actions .= "\t\t\tif(empty(\$this->data['{$associationName}']['{$associationName}'])) { \$this->data['{$associationName}']['{$associationName}'] = null; }\n";
|
$actions .= "\t\t\tif(empty(\$this->data['{$associationName}']['{$associationName}'])) { \$this->data['{$associationName}']['{$associationName}'] = null; }\n";
|
||||||
$actions .= "\t\t\t\$this->set('selected_{$otherPluralName}', \$this->__selectedArray(\$this->data['{$associationName}']['{$associationName}']));\n";
|
$actions .= "\t\t\t\$this->set('selected_{$otherPluralName}', \$this->_selectedArray(\$this->data['{$associationName}']['{$associationName}']));\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($modelObj->belongsTo as $associationName => $relation) {
|
foreach($modelObj->belongsTo as $associationName => $relation) {
|
||||||
|
|
Loading…
Reference in a new issue