diff --git a/src/GuardianManager.php b/src/GuardianManager.php index 4ce98f4..df534c6 100644 --- a/src/GuardianManager.php +++ b/src/GuardianManager.php @@ -33,11 +33,11 @@ final class GuardianManager implements GuardianManagerInterface { protected $configFactory; /** - * The entity type manager service. + * The user storage. * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface + * @var \Drupal\user\UserStorageInterface */ - protected $entityTypeManager; + protected $userStorage; /** * The mail manager service. @@ -112,7 +112,7 @@ final class GuardianManager implements GuardianManagerInterface { */ public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, MailManagerInterface $mail_manager, RequestStack $request_stack, AccountInterface $current_user, SessionManagerInterface $session_manager, TimeInterface $time, EmailValidator $email_validator, ModuleHandlerInterface $module_handler) { $this->configFactory = $config_factory; - $this->entityTypeManager = $entity_type_manager; + $this->userStorage = $entity_type_manager->getStorage('user'); $this->mailManager = $mail_manager; $this->requestStack = $request_stack; $this->currentUser = $current_user; @@ -126,7 +126,7 @@ final class GuardianManager implements GuardianManagerInterface { * {@inheritdoc} */ public function notifyModuleState($isEnabled) { - $site = $this->configFactory->getEditable('system.site')->get('name'); + $site = $this->configFactory->get('system.site')->get('name'); if ($isEnabled) { $subject = $this->t('Guardian has been enabled for @site', [ @@ -150,7 +150,7 @@ final class GuardianManager implements GuardianManagerInterface { $guardian_mail = Settings::get('guardian_mail'); /** @var \Drupal\user\UserInterface $user */ - $user = $this->entityTypeManager->getStorage('user')->load(1); + $user = $this->userStorage->load(1); $this->mailManager->mail('guardian', 'notification', $guardian_mail, $user->getPreferredLangcode(), $params, NULL, TRUE); } @@ -215,9 +215,7 @@ final class GuardianManager implements GuardianManagerInterface { */ public function hasValidData(AccountInterface $account) { /** @var \Drupal\user\UserInterface $user */ - $user = $this->entityTypeManager - ->getStorage('user') - ->load($account->id()); + $user = $this->userStorage->load($account->id()); if ($user && is_null($user->getPassword())) { if ($user->getEmail() == $user->getInitialEmail()) {