1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 05:44:04 +00:00

Execute the bootstrappers in reverse order when reverting to central context

Bootstrappers order may be relevant in specific cases.
For example, when a custom bootstrapper queries the tenant database, it will be placed after the Database bootstrapper and must be reverted before the database connection is reverted back to central.
This commit is contained in:
Marius 2023-11-05 11:41:13 +02:00 committed by GitHub
parent 85c7465aca
commit 1c952023e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,7 @@ class RevertToCentralContext
{ {
event(new RevertingToCentralContext($event->tenancy)); event(new RevertingToCentralContext($event->tenancy));
foreach ($event->tenancy->getBootstrappers() as $bootstrapper) { foreach (array_reverse($event->tenancy->getBootstrappers()) as $bootstrapper) {
$bootstrapper->revert(); $bootstrapper->revert();
} }