major update
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace MintyPHP\Service\AddressBook;
|
||||
|
||||
use MintyPHP\Service\CustomField\CustomFieldServicesFactory;
|
||||
use MintyPHP\Service\Directory\DirectoryServicesFactory;
|
||||
use MintyPHP\Service\User\UserServicesFactory;
|
||||
|
||||
@@ -11,8 +12,12 @@ class AddressBookServicesFactory
|
||||
private ?AddressBookCustomFieldGateway $addressBookCustomFieldGateway = null;
|
||||
private ?AddressBookAvatarGateway $addressBookAvatarGateway = null;
|
||||
private ?AddressBookService $addressBookService = null;
|
||||
private ?UserServicesFactory $userServicesFactory = null;
|
||||
private ?DirectoryServicesFactory $directoryServicesFactory = null;
|
||||
|
||||
public function __construct(
|
||||
private readonly UserServicesFactory $userServicesFactory,
|
||||
private readonly DirectoryServicesFactory $directoryServicesFactory,
|
||||
private readonly CustomFieldServicesFactory $customFieldServicesFactory
|
||||
) {}
|
||||
|
||||
public function createAddressBookService(): AddressBookService
|
||||
{
|
||||
@@ -20,7 +25,7 @@ class AddressBookServicesFactory
|
||||
return $this->addressBookService;
|
||||
}
|
||||
|
||||
$userFactory = $this->userServicesFactory();
|
||||
$userFactory = $this->userServicesFactory;
|
||||
return $this->addressBookService = new AddressBookService(
|
||||
$userFactory->createUserAccountService(),
|
||||
$userFactory->createUserAssignmentService(),
|
||||
@@ -36,7 +41,7 @@ class AddressBookServicesFactory
|
||||
return $this->addressBookDirectoryGateway;
|
||||
}
|
||||
|
||||
$directoryFactory = $this->directoryServicesFactory();
|
||||
$directoryFactory = $this->directoryServicesFactory;
|
||||
return $this->addressBookDirectoryGateway = new AddressBookDirectoryGateway(
|
||||
$directoryFactory->createTenantService(),
|
||||
$directoryFactory->createDepartmentService(),
|
||||
@@ -47,23 +52,15 @@ class AddressBookServicesFactory
|
||||
|
||||
public function createAddressBookCustomFieldGateway(): AddressBookCustomFieldGateway
|
||||
{
|
||||
return $this->addressBookCustomFieldGateway ??= new AddressBookCustomFieldGateway();
|
||||
return $this->addressBookCustomFieldGateway ??= new AddressBookCustomFieldGateway(
|
||||
$this->customFieldServicesFactory->createUserCustomFieldValueService()
|
||||
);
|
||||
}
|
||||
|
||||
public function createAddressBookAvatarGateway(): AddressBookAvatarGateway
|
||||
{
|
||||
return $this->addressBookAvatarGateway ??= new AddressBookAvatarGateway(
|
||||
$this->userServicesFactory()->createUserAvatarService()
|
||||
$this->userServicesFactory->createUserAvatarService()
|
||||
);
|
||||
}
|
||||
|
||||
private function userServicesFactory(): UserServicesFactory
|
||||
{
|
||||
return $this->userServicesFactory ??= new UserServicesFactory();
|
||||
}
|
||||
|
||||
private function directoryServicesFactory(): DirectoryServicesFactory
|
||||
{
|
||||
return $this->directoryServicesFactory ??= new DirectoryServicesFactory();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user