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:
nate 2007-10-11 19:55:24 +00:00
parent b06c7f88e2
commit 5a2a7c8f46

View file

@ -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);
}
}