Skip to content

Commit

Permalink
Perform propagation after deferred binding
Browse files Browse the repository at this point in the history
  • Loading branch information
octoberapp committed Aug 8, 2023
1 parent cdb356a commit 1b1eb77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/Database/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ protected function saveInternal($options = [])
$this->commitDeferredAfter($this->sessionKey);
}

// After save deferred binding
$this->fireEvent('model.saveComplete');

return $result;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Database/Traits/Multisite.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public function initializeMultisite()
$this->bindEvent('model.afterCreate', [$this, 'multisiteAfterCreate']);

// Process propagation last so relations are all set up correctly
$this->bindEvent('model.afterSave', [$this, 'multisiteAfterSave'], -1);
$this->bindEvent('model.saveComplete', [$this, 'multisiteSaveComplete'], -1);

$this->defineMultisiteRelations();
}

/**
* multisiteBeforeSave constructor event
* multisiteBeforeSave constructor event used internally
*/
public function multisiteBeforeSave()
{
Expand All @@ -68,9 +68,9 @@ public function multisiteBeforeSave()
}

/**
* multisiteAfterSave constructor event
* multisiteSaveComplete constructor event used internally
*/
public function multisiteAfterSave()
public function multisiteSaveComplete()
{
if ($this->getSaveOption('propagate') !== true) {
return;
Expand Down Expand Up @@ -102,7 +102,7 @@ public function multisiteAfterSave()
}

/**
* multisiteAfterCreate constructor event
* multisiteAfterCreate constructor event used internally
*/
public function multisiteAfterCreate()
{
Expand Down

0 comments on commit 1b1eb77

Please sign in to comment.