1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 21:24:02 +00:00

Add array support to the storage. (#27)

* Add array support to the storage.
(Existing tests have been modified, but only in a way that makes them more correct than they were, making this a backwards compatible feature.)
This commit is contained in:
Samuel Štancl 2019-02-10 21:45:36 +01:00 committed by GitHub
parent cd803cbb47
commit 83d272007d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 24 deletions

View file

@ -20,7 +20,7 @@ class RedisStorageDriver implements StorageDriver
if (! $id) {
throw new \Exception("Tenant could not be identified on domain {$domain}");
}
return array_merge(['uuid' => $id], $this->getTenantById($id));
return $this->getTenantById($id);
}
/**
@ -49,7 +49,7 @@ class RedisStorageDriver implements StorageDriver
public function createTenant(string $domain, string $uuid): array
{
$this->redis->hmset("domains:$domain", 'tenant_id', $uuid);
$this->redis->hmset("tenants:$uuid", 'uuid', $uuid, 'domain', $domain);
$this->redis->hmset("tenants:$uuid", 'uuid', json_encode($uuid), 'domain', json_encode($domain));
return $this->redis->hgetall("tenants:$uuid");
}