updating scope in Helper::setEntity()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5981 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-11-12 00:57:38 +00:00
parent 25252e678a
commit 6c0e70faa5
2 changed files with 4 additions and 4 deletions

View file

@ -329,11 +329,11 @@ class Helper extends Overloadable {
$parts = preg_split('/\/|\./', $entity);
if($parts[0] !== $view->model) {
$sameScope = true;
if (ClassRegistry::isKeySet($view->model)) {
$modelObj =& ClassRegistry::getObject($view->model);
for ($i = 0; $i < count($parts); $i++) {
if ($modelObj->hasField($parts[$i]) || array_key_exists($parts[$i], $modelObj->validate)) {
$sameScope = true;
$hasField = $i;
break;
}
@ -342,10 +342,10 @@ class Helper extends Overloadable {
}
if (ClassRegistry::isKeySet($parts[0])) {
$sameScope = false;
$newModelObj =& ClassRegistry::getObject($parts[0]);
for ($i = 1; $i < count($parts); $i++) {
if ($newModelObj->hasField($parts[$i]) || array_key_exists($parts[$i], $newModelObj->validate)) {
$sameScope = false;
$hasField = $i;
break;
}

View file

@ -134,7 +134,7 @@ class FormHelper extends AppHelper {
'validates' => (ife(empty($object->validate), array(), array_keys($object->validate)))
);
}
if (isset($this->data[$model]) && isset($this->data[$model][$data['key']]) && !empty($this->data[$model][$data['key']])) {
$created = true;
$id = $this->data[$model][$data['key']];
@ -512,7 +512,7 @@ class FormHelper extends AppHelper {
}
}
}
if ($this->model() === $this->field()) {
$options['type'] = 'select';
$options['multiple'] = 'multiple';