Files
breadcrumb-the-shire/lib/Service/Tenant/TenantServicesFactory.php
2026-03-04 15:56:58 +01:00

61 lines
1.8 KiB
PHP

<?php
namespace MintyPHP\Service\Tenant;
use MintyPHP\Repository\Org\DepartmentRepository;
use MintyPHP\Repository\Tenant\TenantRepository;
use MintyPHP\Repository\Tenant\UserTenantRepository;
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(): TenantRepository
{
return $this->tenantRepositoryFactory->createTenantRepository();
}
public function createDepartmentRepository(): DepartmentRepository
{
return $this->tenantRepositoryFactory->createDepartmentRepository();
}
public function createUserTenantRepository(): UserTenantRepository
{
return $this->tenantRepositoryFactory->createUserTenantRepository();
}
public function createPermissionGateway(): PermissionGateway
{
return $this->permissionGateway;
}
}