1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 19:34:04 +00:00

Syncing: move global ID generation logic to an overridable method

Also make all resource syncing-related listener closures static.

Also correct return type for getGlobalIdentifierKey to string|int.
(We intentionally do not support returning null like many other
"get x key" methods would since such a case might break resource
syncing logic. This is also why we use inline getAttribute() in the
creating listener instead of calling the method.)
This commit is contained in:
Samuel Stancl 2025-11-18 04:02:48 +01:00
parent e079803025
commit 072fcc6326
No known key found for this signature in database
GPG key ID: BA146259A1E16C57
3 changed files with 24 additions and 15 deletions

View file

@ -146,7 +146,9 @@ class TenancyServiceProvider extends ServiceProvider
ResourceSyncing\Events\CentralResourceDetachedFromTenant::class => [
ResourceSyncing\Listeners\DeleteResourceInTenant::class,
],
// Fired only when a synced resource is changed in a different DB than the origin DB (to avoid infinite loops)
// Fired only when a synced resource is changed (as a result of syncing)
// in a different DB than DB from which the change originates (to avoid infinite loops)
ResourceSyncing\Events\SyncedResourceSavedInForeignDatabase::class => [],
// Storage symlinks