Skip to content
Snippets Groups Projects
Commit 8b7f9fe5 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

fixes #4233

Closes #4233

Merge request studip/studip!3066
parent f2368e9a
No related branches found
No related tags found
No related merge requests found
...@@ -1553,6 +1553,13 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate ...@@ -1553,6 +1553,13 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate
} }
$this->setValue($options['foreign_key'], $assoc_foreign_key_value); $this->setValue($options['foreign_key'], $assoc_foreign_key_value);
} }
} elseif (
$value === null
&& $this->db_fields()[$options['foreign_key']]['null'] === 'YES'
) {
$this->resetRelation($field);
$this->setValue($options['foreign_key'], null);
} else { } else {
throw new InvalidArgumentException(sprintf('relation %s expects object of type: %s', $field, $options['class_name'])); throw new InvalidArgumentException(sprintf('relation %s expects object of type: %s', $field, $options['class_name']));
} }
......
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