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

Resolve misc to-dos (#26)

* Resolve delete tenant storage todo

* Delete outdated todo (resolved in #25)

* Delete resource syncing todo (resolved in #11)

* Make it clear that getArgsForTenant() is used during cache invalidation

* Delete redundant __call() and __callStatic() annotations

* Fix code style (php-cs-fixer)

* Revert %tenant_id% to-do removal

* Test all cached resolvers instead of just the domain one

* Make docblock more concise, delete renaming to-do (the name seems fine)

* Fix method in tests

* If route is the only resolver arg, use the tenant as the cache key instead of encoded route instance

* Resolve to-do

* make docblock more clear

* Add comments to getResolverArgument()

* Rename $id to $tenantKey

* Fix code style (php-cs-fixer)

* Add regression test for forgetting tenant parameters of cached tenants

* Forget route parameter when tenant gets resolved

* Add parameter type

* Simplify getCacheKey()

* Resolvers wip

* Resolvers wip

* Fix code style (php-cs-fixer)

* Bring back the route instance check to getCacheKey, fix test

* add todo

* add assertion

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
This commit is contained in:
lukinovec 2024-02-10 18:38:05 +01:00 committed by GitHub
parent 80b1183fbf
commit aa1437fb5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 140 additions and 56 deletions

View file

@ -11,9 +11,6 @@ class DeleteTenantStorage
{
public function handle(DeletingTenant $event): void
{
// todo@lukas since this is using the 'File' facade instead of low-level PHP functions, Tenancy might affect this?
// Therefore, when Tenancy is initialized, this might look INSIDE the tenant's storage, instead of the main storage dir?
// The DeletingTenant event will be fired in the central context in 99% of cases, but sometimes it might run in the tenant context (from another tenant) so we want to make sure this works well in all contexts.
File::deleteDirectory($event->tenant->run(fn () => storage_path()));
}
}

View file

@ -16,8 +16,6 @@ use Stancl\Tenancy\Events\SyncedResourceSaved;
use Stancl\Tenancy\Exceptions\ModelNotSyncMasterException;
use Stancl\Tenancy\Tenancy;
// todo@v4 review all code related to resource syncing
class UpdateSyncedResource extends QueueableListener
{
public static bool $shouldQueue = false;