Skip to content

Commit

Permalink
Get rid of TenantDatabaseDoesNotExist exception
Browse files Browse the repository at this point in the history
  • Loading branch information
stancl committed Jun 29, 2020
1 parent 1e18dc3 commit fe52a3c
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 27 deletions.
7 changes: 0 additions & 7 deletions src/Bootstrappers/DatabaseTenancyBootstrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Stancl\Tenancy\Contracts\Tenant;
use Stancl\Tenancy\Contracts\TenantWithDatabase;
use Stancl\Tenancy\Database\DatabaseManager;
use Stancl\Tenancy\Exceptions\TenantDatabaseDoesNotExistException;

class DatabaseTenancyBootstrapper implements TenancyBootstrapper
{
Expand All @@ -22,12 +21,6 @@ public function __construct(DatabaseManager $database)

public function bootstrap(Tenant $tenant)
{
/** @var TenantWithDatabase $tenant */
$database = $tenant->database()->getName();
if (! $tenant->database()->manager()->databaseExists($database)) {
throw new TenantDatabaseDoesNotExistException($database);
}

$this->database->connectToTenant($tenant);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function getSolution(): Solution
return BaseSolution::create('Tenant could not be identified on this path')
->setSolutionDescription('Did you forget to create a tenant for this path?')
->setDocumentationLinks([
'Creating Tenants' => 'https://tenancyforlaravel.com/docs/v2/creating-tenants/', // todo update link for v3
'Creating Tenants' => 'https://tenancyforlaravel.com/docs/v3/tenants/',
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function getSolution(): Solution
return BaseSolution::create('Tenant could not be identified with this request data')
->setSolutionDescription('Did you forget to create a tenant with this id?')
->setDocumentationLinks([
'Creating Tenants' => 'https://tenancyforlaravel.com/docs/v2/creating-tenants/', // todo update link for v3
'Creating Tenants' => 'https://tenancyforlaravel.com/docs/v3/tenants/',
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function getSolution(): Solution
return BaseSolution::create('Tenant could not be identified on this domain')
->setSolutionDescription('Did you forget to create a tenant for this domain?')
->setDocumentationLinks([
'Creating Tenants' => 'https://tenancyforlaravel.com/docs/v2/creating-tenants/', // todo update link for v3
'Creating Tenants' => 'https://tenancyforlaravel.com/docs/v3/tenants/',
]);
}
}
15 changes: 0 additions & 15 deletions src/Exceptions/TenantDatabaseDoesNotExistException.php

This file was deleted.

2 changes: 0 additions & 2 deletions tests/CachedTenantResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,4 @@ public function cache_is_invalidated_when_a_tenants_domain_is_changed()
$this->assertTrue($tenant->is(app(DomainTenantResolver::class)->resolve('bar')));
$this->assertNotEmpty(DB::getQueryLog()); // not empty
}

// todo2 at some point in the future, we could write invalidation tests for the other resolvers too
}

0 comments on commit fe52a3c

Please sign in to comment.