refactor(arch): enforce gateway compliance and remove service-wrapping gateways
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace MintyPHP\Service\Import\Profile;
|
||||
|
||||
use MintyPHP\Service\User\UserAccountService;
|
||||
|
||||
class UserImportProfile implements ImportProfileInterface
|
||||
{
|
||||
/**
|
||||
@@ -9,8 +11,10 @@ class UserImportProfile implements ImportProfileInterface
|
||||
*/
|
||||
private ?array $allowedLocales = null;
|
||||
|
||||
public function __construct(private readonly UserImportGateway $gateway)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UserImportGateway $gateway,
|
||||
private readonly UserAccountService $userAccountService
|
||||
) {
|
||||
}
|
||||
|
||||
public function key(): string
|
||||
@@ -203,7 +207,7 @@ class UserImportProfile implements ImportProfileInterface
|
||||
$input['active'] = null;
|
||||
}
|
||||
|
||||
$result = $this->gateway->createUserFromAdmin($input, (int) ($context['current_user_id'] ?? 0));
|
||||
$result = $this->userAccountService->createFromAdmin($input, (int) ($context['current_user_id'] ?? 0));
|
||||
if (!($result['ok'] ?? false)) {
|
||||
$errors = $result['errors'] ?? [];
|
||||
$message = is_array($errors) && isset($errors[0]) ? (string) $errors[0] : t('User can not be registered');
|
||||
|
||||
Reference in New Issue
Block a user