Permalink
Browse files

Handle multiple=false case in mnrelation

  • Loading branch information...
flack committed Nov 7, 2017
1 parent 3626f4f commit 618b1f39d9ebac5ee43c4c04e7b05c9a7dfdaeed
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/midcom/datamanager/storage/mnrelation.php
@@ -20,6 +20,7 @@ public function __construct($object, $config)
parent::__construct($object, $config);
$defaults = [
'sortable' => false,
'allow_multiple' => true,
'mapping_class_name' => null,
'master_fieldname' => null,
'member_fieldname' => null,
@@ -62,7 +63,10 @@ public function load()
if (!$this->get_master_foreign_key()) {
return [];
}
return array_keys($this->load_objects());
if ($this->config['type_config']['allow_multiple']) {
return array_keys($this->load_objects());
}
return key($this->load_objects());
}
private function create_relation($member_key)

0 comments on commit 618b1f3

Please sign in to comment.