1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 22:14:03 +00:00

Clean up TenantCannotBeCreatedException

This commit is contained in:
Samuel Štancl 2019-09-15 09:40:53 +02:00
parent 2657df5a88
commit 15a7db9e71
5 changed files with 12 additions and 18 deletions

View file

@ -83,14 +83,8 @@ class TenantManager
*/
public function ensureTenantCanBeCreated(Tenant $tenant): void
{
// todo move the "throw" responsibility to the canCreateTenant methods?
if (($e = $this->storage->canCreateTenant($tenant)) instanceof TenantCannotBeCreatedException) {
throw new $e;
}
if (($e = $this->database->canCreateTenant($tenant)) instanceof TenantCannotBeCreatedException) {
throw new $e;
}
$this->storage->ensureTenantCanBeCreated($tenant);
$this->database->ensureTenantCanBeCreated($tenant);
}
public function updateTenant(Tenant $tenant): self