Files
breadcrumb-the-shire/core/Service/CustomField/CustomFieldServicesFactory.php

40 lines
1.6 KiB
PHP
Raw Normal View History

2026-03-04 15:56:58 +01:00
<?php
namespace MintyPHP\Service\CustomField;
use MintyPHP\Repository\Tenant\TenantRepository;
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,
private readonly TenantScopeService $userScopeGateway,
private readonly CustomFieldRepositoryFactory $customFieldRepositoryFactory
2026-03-04 15:56:58 +01:00
) {
}
public function createTenantCustomFieldService(): TenantCustomFieldService
{
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
{
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
}
}