2026-03-04 15:56:58 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MintyPHP\Service\CustomField;
|
|
|
|
|
|
|
|
|
|
use MintyPHP\Repository\Tenant\TenantRepository;
|
2026-03-13 11:31:33 +01:00
|
|
|
use MintyPHP\Service\Tenant\TenantScopeService;
|
2026-03-04 15:56:58 +01:00
|
|
|
|
|
|
|
|
class CustomFieldServicesFactory
|
|
|
|
|
{
|
|
|
|
|
private ?TenantCustomFieldService $tenantCustomFieldService = null;
|
|
|
|
|
private ?UserCustomFieldValueService $userCustomFieldValueService = null;
|
|
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
|
private readonly TenantRepository $tenantRepository,
|
2026-04-22 19:32:14 +02:00
|
|
|
private readonly TenantScopeService $userScopeGateway,
|
|
|
|
|
private readonly CustomFieldRepositoryFactory $customFieldRepositoryFactory
|
2026-03-04 15:56:58 +01:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createTenantCustomFieldService(): TenantCustomFieldService
|
|
|
|
|
{
|
2026-04-22 19:32:14 +02:00
|
|
|
return $this->tenantCustomFieldService ??= new TenantCustomFieldService(
|
|
|
|
|
$this->tenantRepository,
|
|
|
|
|
$this->customFieldRepositoryFactory->createTenantCustomFieldDefinitionRepository(),
|
|
|
|
|
$this->customFieldRepositoryFactory->createTenantCustomFieldOptionRepository(),
|
|
|
|
|
);
|
2026-03-04 15:56:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createUserCustomFieldValueService(): UserCustomFieldValueService
|
|
|
|
|
{
|
2026-04-22 19:32:14 +02:00
|
|
|
return $this->userCustomFieldValueService ??= new UserCustomFieldValueService(
|
|
|
|
|
$this->userScopeGateway,
|
|
|
|
|
$this->customFieldRepositoryFactory->createTenantCustomFieldDefinitionRepository(),
|
|
|
|
|
$this->customFieldRepositoryFactory->createTenantCustomFieldOptionRepository(),
|
|
|
|
|
$this->customFieldRepositoryFactory->createUserCustomFieldValueRepository(),
|
|
|
|
|
$this->customFieldRepositoryFactory->createUserCustomFieldValueOptionRepository(),
|
|
|
|
|
);
|
2026-03-04 15:56:58 +01:00
|
|
|
}
|
|
|
|
|
}
|