From 872ef259819f95bd5b43904880ae9668f7ac63e0 Mon Sep 17 00:00:00 2001 From: Roy de Jong Date: Thu, 10 Oct 2024 17:00:14 +0200 Subject: [PATCH] feat(model): add getAutoApplicatorEnabled (disable option) --- lib/Model.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/Model.php b/lib/Model.php index be659ce..70df22f 100644 --- a/lib/Model.php +++ b/lib/Model.php @@ -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. * @@ -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) {