mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 01:34:02 +00:00
[2.1.0] Fix queue race conditions (#178)
* Add TenantDoesNotExist exception, fix queued migrator serialization * wip * Apply fixes from StyleCI * Use only one config for queueing * Apply fixes from StyleCI * rename test * rename test
This commit is contained in:
parent
e98db460ec
commit
3e78410d8a
8 changed files with 78 additions and 28 deletions
|
|
@ -10,6 +10,7 @@ use Stancl\Tenancy\Contracts\StorageDriver;
|
|||
use Stancl\Tenancy\DatabaseManager;
|
||||
use Stancl\Tenancy\Exceptions\DomainsOccupiedByOtherTenantException;
|
||||
use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedException;
|
||||
use Stancl\Tenancy\Exceptions\TenantDoesNotExistException;
|
||||
use Stancl\Tenancy\Exceptions\TenantWithThisIdAlreadyExistsException;
|
||||
use Stancl\Tenancy\StorageDrivers\Database\DomainModel as Domains;
|
||||
use Stancl\Tenancy\StorageDrivers\Database\TenantModel as Tenants;
|
||||
|
|
@ -59,7 +60,13 @@ class DatabaseStorageDriver implements StorageDriver
|
|||
|
||||
public function findById(string $id): Tenant
|
||||
{
|
||||
return Tenant::fromStorage(Tenants::find($id)->decoded())
|
||||
$tenant = Tenants::find($id);
|
||||
|
||||
if (! $tenant) {
|
||||
throw new TenantDoesNotExistException($id);
|
||||
}
|
||||
|
||||
return Tenant::fromStorage($tenant->decoded())
|
||||
->withDomains($this->getTenantDomains($id));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue