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

Remove some todos

This commit is contained in:
Samuel Štancl 2019-09-08 14:40:49 +02:00
parent dc540f3b10
commit b0d119753d
6 changed files with 11 additions and 20 deletions

View file

@ -10,6 +10,5 @@ use Stancl\Tenancy\TenantManager;
// todo should this be FeatureProvider? // todo should this be FeatureProvider?
interface Feature interface Feature
{ {
// todo is the tenantManager argument necessary?
public function bootstrap(TenantManager $tenantManager): void; public function bootstrap(TenantManager $tenantManager): void;
} }

View file

@ -9,9 +9,9 @@ use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedException;
interface StorageDriver interface StorageDriver
{ {
public function createTenant(Tenant $tenant): bool; // todo return type public function createTenant(Tenant $tenant): bool;
public function updateTenant(Tenant $tenant): bool; // todo return type public function updateTenant(Tenant $tenant): bool;
/** /**
* Find a tenant using an id. * Find a tenant using an id.

View file

@ -8,7 +8,6 @@ use Stancl\Tenancy\Tenant;
interface TenancyBootstrapper interface TenancyBootstrapper
{ {
public function start(Tenant $tenant); // todo better name? public function start(Tenant $tenant);
public function end();
public function end(Tenant $tenant); // todo arg?
} }

View file

@ -21,7 +21,7 @@ class QueueTenancyBootstrapper implements TenancyBootstrapper
$this->app['queue']->createPayloadUsing([$this, 'createPayload']); $this->app['queue']->createPayloadUsing([$this, 'createPayload']);
$this->app['events']->listen(\Illuminate\Queue\Events\JobProcessing::class, function ($event) { $this->app['events']->listen(\Illuminate\Queue\Events\JobProcessing::class, function ($event) {
if (\array_key_exists('tenant_id', $event->job->payload())) { if (\array_key_exists('tenant_id', $event->job->payload())) {
tenancy()->initById($event->job->payload()['tenant_id']); // todo tenancy()->initById($event->job->payload()['tenant_id']);
} }
}); });
} }

View file

@ -7,7 +7,6 @@ namespace Stancl\Tenancy;
use ArrayAccess; use ArrayAccess;
// todo tenant storage // todo tenant storage
// todo create tenant - create db?
/** /**
* @internal Class is subject to breaking changes in minor and patch versions. * @internal Class is subject to breaking changes in minor and patch versions.

View file

@ -6,25 +6,16 @@ namespace Stancl\Tenancy;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
// todo move this to a database driver domain?
/** /**
* @internal Class is subject to breaking changes in minor and patch versions. * @internal Class is subject to breaking changes in minor and patch versions.
*/ */
class TenantModel extends Model class TenantModel extends Model
{ {
protected $guarded = []; protected $guarded = [];
protected $primaryKey = 'uuid'; protected $primaryKey = 'id';
public $incrementing = false; public $incrementing = false;
public $timestamps = false; public $timestamps = false;
/**
* Decoded data from the data column.
*
* @var object
*/
private $dataObject;
public static function dataColumn() public static function dataColumn()
{ {
return config('tenancy.storage.db.data_column', 'data'); return config('tenancy.storage.db.data_column', 'data');
@ -87,10 +78,13 @@ class TenantModel extends Model
return $this->attributes[$key] ?? $this->getFromData($key) ?? null; return $this->attributes[$key] ?? $this->getFromData($key) ?? null;
} }
/** @todo In v2, this should return an associative array. */
public function getMany(array $keys): array public function getMany(array $keys): array
{ {
return \array_map([$this, 'get'], $keys); return array_reduce($keys, function ($result, $key) {
$result[$key] = $this->get[$key];
return $result;
}, []);
} }
public function put(string $key, $value) public function put(string $key, $value)