mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing undefined offset issue with multi-select elements
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5750 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
b06c7f88e2
commit
5a2a7c8f46
1 changed files with 5 additions and 3 deletions
|
@ -428,7 +428,8 @@ class Helper extends Overloadable {
|
|||
$name = $field;
|
||||
break;
|
||||
default:
|
||||
$name = array_filter(array($this->model(), $this->field(), $this->modelID()));
|
||||
//$name = array_filter(array($this->model(), $this->field(), $this->modelID()));
|
||||
$name = array_filter(array($this->model(), $this->field()));
|
||||
if ($this->modelID() === 0) {
|
||||
$name[] = $this->modelID();
|
||||
}
|
||||
|
@ -468,12 +469,13 @@ class Helper extends Overloadable {
|
|||
}
|
||||
|
||||
$result = null;
|
||||
|
||||
if (isset($this->data[$this->model()][$this->field()])) {
|
||||
$result = $this->data[$this->model()][$this->field()];
|
||||
} elseif (isset($this->data[$this->field()]) && is_array($this->data[$this->field()])) {
|
||||
if (ClassRegistry::isKeySet($this->field())) {
|
||||
$key =& ClassRegistry::getObject($this->field());
|
||||
$result = $this->__selectedArray($this->data[$this->field()], $key->primaryKey);
|
||||
$model =& ClassRegistry::getObject($this->field());
|
||||
$result = $this->__selectedArray($this->data[$this->field()], $model->primaryKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue