Skip to content
Snippets Groups Projects
Commit c79263d7 authored by André Noack's avatar André Noack
Browse files

Resolve "FormBuilder kann nicht mit zusätzlichen SORM Attributen umgehen"

Closes #3706

Merge request studip/studip!2578
parent c15ee4ba
No related branches found
No related tags found
No related merge requests found
...@@ -129,7 +129,11 @@ class Form extends Part ...@@ -129,7 +129,11 @@ class Form extends Part
} }
foreach ($params['fields'] as $fieldname => $fielddata) { foreach ($params['fields'] as $fieldname => $fielddata) {
if (is_array($fielddata) && !array_key_exists('value', $fielddata)) { if (is_array($fielddata) && !array_key_exists('value', $fielddata)) {
if ($object->isField($fieldname)) { if (
$object->isField($fieldname)
|| $object->isAdditionalField($fieldname)
|| $object->isAliasField($fieldname)
) {
$params['fields'][$fieldname]['value'] = $object[$fieldname]; $params['fields'][$fieldname]['value'] = $object[$fieldname];
} }
} }
...@@ -412,7 +416,6 @@ class Form extends Part ...@@ -412,7 +416,6 @@ class Form extends Part
} }
$all_values[$input->getName()] = $value; $all_values[$input->getName()] = $value;
} }
foreach ($this->parts as $part) { foreach ($this->parts as $part) {
$context = $part->getContextObject(); $context = $part->getContextObject();
if ($context && method_exists($context, 'store')) { if ($context && method_exists($context, 'store')) {
...@@ -514,7 +517,12 @@ class Form extends Part ...@@ -514,7 +517,12 @@ class Form extends Part
if ( if (
$context $context
&& is_subclass_of($context, \SimpleORMap::class) && is_subclass_of($context, \SimpleORMap::class)
&& ($context->isField($input->getName()) || $context->isRelation($input->getName())) && (
$context->isField($input->getName())
|| $context->isAdditionalField($input->getName())
|| $context->isAliasField($input->getName())
|| $context->isRelation($input->getName())
)
) { ) {
return function ($value) use ($context, $input) { return function ($value) use ($context, $input) {
if ($context && !$value && $value !== null) { if ($context && !$value && $value !== null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment