Skip to content

Commit

Permalink
Remove temporary file assignment after validation
Browse files Browse the repository at this point in the history
This can cause problems when the relation is set to a HttpObject and validation fails, during the update, the relation is now set to something invalid for rendering. So we should unset it
  • Loading branch information
daftspunk committed Apr 14, 2024
1 parent d24fda6 commit 804d300
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Database/Relations/AttachOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public function setSimpleValue($value)

// The relation is set here to satisfy validation
$this->parent->setRelation($this->relationName, $value);

$this->parent->bindEventOnce('model.afterValidate', function() {
$this->parent->unsetRelation($this->relationName);
});
}

/**
Expand Down

0 comments on commit 804d300

Please sign in to comment.