1
0
Files
breadcrumb-the-shire/lib/Service/Tenant/TenantServicesFactory.php
2026-03-05 11:17:42 +01:00

62 lines
1.9 KiB
PHP

<?php
namespace MintyPHP\Service\Tenant;
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
use MintyPHP\Repository\Tenant\UserTenantRepositoryInterface;
use MintyPHP\Service\Access\PermissionGateway;
class TenantServicesFactory
{
private ?TenantScopeService $tenantScopeService = null;
private ?TenantAvatarService $tenantAvatarService = null;
private ?TenantFaviconService $tenantFaviconService = null;
public function __construct(
private readonly PermissionGateway $permissionGateway,
private readonly TenantRepositoryFactory $tenantRepositoryFactory
) {
}
public function createTenantScopeService(): TenantScopeService
{
return $this->tenantScopeService ??= new TenantScopeService(
$this->createTenantRepository(),
$this->createDepartmentRepository(),
$this->createUserTenantRepository(),
$this->createPermissionGateway()
);
}
public function createTenantAvatarService(): TenantAvatarService
{
return $this->tenantAvatarService ??= new TenantAvatarService();
}
public function createTenantFaviconService(): TenantFaviconService
{
return $this->tenantFaviconService ??= new TenantFaviconService();
}
public function createTenantRepository(): TenantRepositoryInterface
{
return $this->tenantRepositoryFactory->createTenantRepository();
}
public function createDepartmentRepository(): DepartmentRepositoryInterface
{
return $this->tenantRepositoryFactory->createDepartmentRepository();
}
public function createUserTenantRepository(): UserTenantRepositoryInterface
{
return $this->tenantRepositoryFactory->createUserTenantRepository();
}
public function createPermissionGateway(): PermissionGateway
{
return $this->permissionGateway;
}
}