1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 16:14:03 +00:00

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:09:42 +01:00
parent f9f71ec49f
commit f3e2642fa2
3 changed files with 61 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,8 @@ 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', $uuid, 'domain', $domain);
$this->redis->hmset("tenants:$uuid", 'uuid', json_encode($uuid), 'domain', json_encode($domain));
return $this->redis->hgetall("tenants:$uuid");
}