forked from fa/breadcrumb-the-shire
Migrates addressbook service classes from core namespace (MintyPHP\Service\AddressBook\*) to proper module namespace (MintyPHP\Module\AddressBook\Service\*), consistent with the bookmarks module pattern. Moved to module: - AddressBookService → modules/addressbook/lib/Module/AddressBook/Service/ - AddressBookServicesFactory → modules/addressbook/lib/Module/AddressBook/Service/ - AddressBookServiceTest → modules/addressbook/tests/Module/AddressBook/Service/ - Pages, templates, CSS, JS all in module directory All module PHP classes now live under MintyPHP\Module\<Name>\*, enforced by ModuleStructureContractTest::testModuleClassesUseModuleNamespace. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Module\AddressBook\Service;
|
|
|
|
use MintyPHP\Service\CustomField\CustomFieldServicesFactory;
|
|
use MintyPHP\Service\Directory\DirectoryServicesFactory;
|
|
use MintyPHP\Service\Tenant\TenantScopeService;
|
|
use MintyPHP\Service\User\UserServicesFactory;
|
|
|
|
class AddressBookServicesFactory
|
|
{
|
|
private ?AddressBookService $addressBookService = null;
|
|
|
|
public function __construct(
|
|
private readonly UserServicesFactory $userServicesFactory,
|
|
private readonly DirectoryServicesFactory $directoryServicesFactory,
|
|
private readonly CustomFieldServicesFactory $customFieldServicesFactory,
|
|
private readonly TenantScopeService $tenantScopeService
|
|
) {
|
|
}
|
|
|
|
public function createAddressBookService(): AddressBookService
|
|
{
|
|
if ($this->addressBookService !== null) {
|
|
return $this->addressBookService;
|
|
}
|
|
|
|
$userFactory = $this->userServicesFactory;
|
|
$directoryFactory = $this->directoryServicesFactory;
|
|
return $this->addressBookService = new AddressBookService(
|
|
$userFactory->createUserAccountService(),
|
|
$userFactory->createUserAssignmentService(),
|
|
$directoryFactory->createTenantService(),
|
|
$directoryFactory->createDepartmentService(),
|
|
$directoryFactory->createRoleService(),
|
|
$this->tenantScopeService,
|
|
$this->customFieldServicesFactory->createUserCustomFieldValueService(),
|
|
$userFactory->createUserAvatarService()
|
|
);
|
|
}
|
|
}
|