mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
fixing habtm
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5967 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
58ead8aa5c
commit
42767170d1
2 changed files with 12 additions and 13 deletions
|
@ -338,6 +338,9 @@ class Helper extends Overloadable {
|
||||||
$hasField = 0;
|
$hasField = 0;
|
||||||
$sameScope = true;
|
$sameScope = true;
|
||||||
}
|
}
|
||||||
|
if (in_array($model, array_keys($tmpModelObject->hasAndBelongsToMany))) {
|
||||||
|
$hasField = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($parts[0] == '_Token' && isset($parts[1])) {
|
if ($parts[0] == '_Token' && isset($parts[1])) {
|
||||||
|
@ -366,6 +369,7 @@ class Helper extends Overloadable {
|
||||||
$view->modelId = null;
|
$view->modelId = null;
|
||||||
if ($view->modelScope) {
|
if ($view->modelScope) {
|
||||||
$view->association = $parts[0];
|
$view->association = $parts[0];
|
||||||
|
$view->field = $parts[0];
|
||||||
} else {
|
} else {
|
||||||
$view->model = $parts[0];
|
$view->model = $parts[0];
|
||||||
}
|
}
|
||||||
|
@ -488,6 +492,7 @@ class Helper extends Overloadable {
|
||||||
$this->setEntity($options);
|
$this->setEntity($options);
|
||||||
return $this->domId();
|
return $this->domId();
|
||||||
}
|
}
|
||||||
|
|
||||||
$dom = $this->model() . Inflector::camelize($view->field) . Inflector::camelize($view->fieldSuffix);
|
$dom = $this->model() . Inflector::camelize($view->field) . Inflector::camelize($view->fieldSuffix);
|
||||||
|
|
||||||
if (is_array($options) && !array_key_exists($id, $options)) {
|
if (is_array($options) && !array_key_exists($id, $options)) {
|
||||||
|
|
|
@ -123,19 +123,16 @@ class FormHelper extends AppHelper {
|
||||||
if (empty($fields)) {
|
if (empty($fields)) {
|
||||||
trigger_error(__('(FormHelper::create) Unable to use model field data. If you are using a model without a database table, try implementing schema()', true), E_USER_WARNING);
|
trigger_error(__('(FormHelper::create) Unable to use model field data. If you are using a model without a database table, try implementing schema()', true), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
$data = array(
|
if (!empty($object->hasAndBelongsToMany)) {
|
||||||
|
foreach ($object->hasAndBelongsToMany as $alias => $assocData) {
|
||||||
|
$fields[$alias] = array('type' => 'multiple');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->fieldset = array(
|
||||||
'fields' => $fields,
|
'fields' => $fields,
|
||||||
'key' => $object->primaryKey,
|
'key' => $object->primaryKey,
|
||||||
'validates' => (ife(empty($object->validate), array(), array_keys($object->validate)))
|
'validates' => (ife(empty($object->validate), array(), array_keys($object->validate)))
|
||||||
);
|
);
|
||||||
|
|
||||||
$habtm = array();
|
|
||||||
if (!empty($object->hasAndBelongsToMany)) {
|
|
||||||
foreach ($object->hasAndBelongsToMany as $alias => $assocData) {
|
|
||||||
$data['fields'][$alias] = array('type' => 'multiple');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->fieldset = $data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->data[$model]) && isset($this->data[$model][$data['key']]) && !empty($this->data[$model][$data['key']])) {
|
if (isset($this->data[$model]) && isset($this->data[$model][$data['key']]) && !empty($this->data[$model][$data['key']])) {
|
||||||
|
@ -509,9 +506,6 @@ class FormHelper extends AppHelper {
|
||||||
|
|
||||||
if (isset($map[$type])) {
|
if (isset($map[$type])) {
|
||||||
$options['type'] = $map[$type];
|
$options['type'] = $map[$type];
|
||||||
} elseif ($type === 'multiple') {
|
|
||||||
$fieldName = $this->field().'.'.$this->field();
|
|
||||||
$this->setEntity($fieldName);
|
|
||||||
}
|
}
|
||||||
if ($this->field() == $primaryKey) {
|
if ($this->field() == $primaryKey) {
|
||||||
$options['type'] = 'hidden';
|
$options['type'] = 'hidden';
|
||||||
|
|
Loading…
Add table
Reference in a new issue