Skip to content

Commit

Permalink
Jet Core
Browse files Browse the repository at this point in the history
------------
* ORM DataModel: Bug fix: An assigned sub-entity that has not yet been saved must not be deleted when the parent entity is deleted.
  • Loading branch information
mirekmarek committed Aug 3, 2024
1 parent 1c094f1 commit 73ac0c3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion library/Jet/DataModel/Trait/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ public function delete(): void

if(is_array($prop)) {
foreach($prop as $v) {
if( $v instanceof DataModel_Related ) {
if(
$v instanceof DataModel_Related &&
$v->getIsSaved()
) {
$v->delete();
}
}
Expand Down

0 comments on commit 73ac0c3

Please sign in to comment.