feat: cli tenant support
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -16,4 +16,9 @@ class TenantService
|
||||
return $this->store->fetchByDomain($domain);
|
||||
}
|
||||
|
||||
public function fetchById(string $identifier): ?TenantObject
|
||||
{
|
||||
return $this->store->fetch($identifier);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,26 @@ class SessionTenant
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the tenant by its identifier (for console / CLI usage).
|
||||
*/
|
||||
public function configureById(string $identifier): void
|
||||
{
|
||||
if ($this->configured) {
|
||||
return;
|
||||
}
|
||||
$tenant = $this->tenantService->fetchById($identifier);
|
||||
if ($tenant) {
|
||||
$this->domain = $identifier;
|
||||
$this->tenant = $tenant;
|
||||
$this->configured = true;
|
||||
} else {
|
||||
$this->domain = null;
|
||||
$this->tenant = null;
|
||||
$this->configured = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the tenant configured
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user