Skip to content

Commit

Permalink
feat(model): add getAutoApplicatorEnabled (disable option)
Browse files Browse the repository at this point in the history
  • Loading branch information
roydejong committed Oct 10, 2024
1 parent 4d39564 commit 872ef25
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,15 @@ public function tryBecomeExisting(): bool
return true;
}

/**
* Gets whether "auto applicator" is enabled for this model.
* Default implementation returns true.
*/
protected function getAutoApplicatorEnabled(): bool
{
return true;
}

/**
* Performs any @auto hooks before committing new or changed models to the database.
*
Expand All @@ -781,6 +790,10 @@ public function tryBecomeExisting(): bool
*/
protected function runAutoApplicator(string $reason): bool
{
if (!$this->getAutoApplicatorEnabled()) {
return false;
}

$anyChanges = false;

foreach ($this->getTableInfo()->getColumns() as $column) {
Expand Down

0 comments on commit 872ef25

Please sign in to comment.