Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUG UnsavedRelationList aren't checked

When saveInto is called on ListboxField and CheckboxsetField,
UnsavedRelationList should be an acceptable relationship type. This is
leading to relations not being saved on initial creation of Member
objects
  • Loading branch information...
commit 4e360201183f03c5c31e5b3160b0bba63a48c501 1 parent 920fd71
@dhensby dhensby authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  forms/CheckboxSetField.php
  2. +1 −1  forms/ListboxField.php
View
2  forms/CheckboxSetField.php
@@ -181,7 +181,7 @@ public function setValue($value, $obj = null) {
public function saveInto(DataObjectInterface $record) {
$fieldname = $this->name;
$relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null;
- if($fieldname && $record && $relation && $relation instanceof RelationList) {
+ if($fieldname && $record && $relation && ($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) {
$idList = array();
if($this->value) foreach($this->value as $id => $bool) {
if($bool) {
View
2  forms/ListboxField.php
@@ -179,7 +179,7 @@ public function saveInto(DataObjectInterface $record) {
if($this->multiple) {
$fieldname = $this->name;
$relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null;
- if($fieldname && $record && $relation && $relation instanceof RelationList) {
+ if($fieldname && $record && $relation && ($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) {
$idList = (is_array($this->value)) ? array_values($this->value) : array();
if(!$record->ID) {
$record->write(); // record needs to have an ID in order to set relationships
Please sign in to comment.
Something went wrong with that request. Please try again.