mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 21:54:03 +00:00
Clean up TenantCannotBeCreatedException
This commit is contained in:
parent
2657df5a88
commit
15a7db9e71
5 changed files with 12 additions and 18 deletions
|
|
@ -92,15 +92,14 @@ class DatabaseManager
|
|||
* Check if a tenant can be created.
|
||||
*
|
||||
* @param Tenant $tenant
|
||||
* @return true|TenantCannotBeCreatedException
|
||||
* @return void
|
||||
* @throws TenantCannotBeCreatedException
|
||||
*/
|
||||
public function canCreate(Tenant $tenant)
|
||||
public function ensureTenantCanBeCreated(Tenant $tenant): void
|
||||
{
|
||||
if ($this->getTenantDatabaseManager($tenant)->databaseExists($database = $tenant->getDatabaseName())) {
|
||||
return new TenantDatabaseAlreadyExistsException($database);
|
||||
throw new TenantDatabaseAlreadyExistsException($database);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function createDatabase(Tenant $tenant)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue