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

Add unsetTenantConfig

This commit is contained in:
Samuel Štancl 2019-09-27 21:01:31 +02:00
parent 72d16d8efd
commit 6d12e629b8

View file

@ -14,9 +14,16 @@ class TenantConfig implements Feature
/** @var Application */
protected $app;
/** @var array */
public $originalConfig = [];
public function __construct(Application $app)
{
$this->app = $app;
foreach ($this->getStorageToConfigMap() as $configKey) {
$this->originalConfig[$configKey] = $this->app['config'][$configKey];
}
}
public function bootstrap(TenantManager $tenantManager): void
@ -37,6 +44,13 @@ class TenantConfig implements Feature
}
}
public function unsetTenantConfig(): void
{
foreach ($this->getStorageToConfigMap() as $configKey) {
$this->app['config'][$configKey] = $this->originalConfig[$configKey];
}
}
public function getStorageToConfigMap(): array
{
return $this->app['config']['tenancy.storage_to_config_map'] ?? [];