Skip to content

Commit

Permalink
Ability to write to a $belongs_to relation
Browse files Browse the repository at this point in the history
  • Loading branch information
wernerkrauss authored Mar 20, 2017
1 parent 46b841a commit df833fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/DataObjectExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function onBeforeWrite() {
}
$value = (string)$value['after'];
list($hasone, $key) = explode(self::separator, $name, 2);
if($this->owner->has_one($hasone)) {
if($this->owner->has_one($hasone) || $this->owner->belongs_to($hasone)) {
$rel = $this->owner->getComponent($hasone);

// Get original:
Expand Down

0 comments on commit df833fb

Please sign in to comment.