diff core/modules/user/src/UserAuth.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/core/modules/user/src/UserAuth.php	Thu Feb 28 13:21:36 2019 +0000
+++ b/core/modules/user/src/UserAuth.php	Thu May 09 15:33:08 2019 +0100
@@ -2,20 +2,27 @@
 
 namespace Drupal\user;
 
-use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Password\PasswordInterface;
 
 /**
  * Validates user authentication credentials.
  */
 class UserAuth implements UserAuthInterface {
+  use DeprecatedServicePropertyTrait;
 
   /**
-   * The entity manager.
+   * {@inheritdoc}
+   */
+  protected $deprecatedProperties = ['entityManager' => 'entity.manager'];
+
+  /**
+   * The entity type manager.
    *
-   * @var \Drupal\Core\Entity\EntityManagerInterface
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
    */
-  protected $entityManager;
+  protected $entityTypeManager;
 
   /**
    * The password hashing service.
@@ -27,13 +34,13 @@
   /**
    * Constructs a UserAuth object.
    *
-   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
-   *   The entity manager.
+   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+   *   The entity type manager.
    * @param \Drupal\Core\Password\PasswordInterface $password_checker
    *   The password service.
    */
-  public function __construct(EntityManagerInterface $entity_manager, PasswordInterface $password_checker) {
-    $this->entityManager = $entity_manager;
+  public function __construct(EntityTypeManagerInterface $entity_type_manager, PasswordInterface $password_checker) {
+    $this->entityTypeManager = $entity_type_manager;
     $this->passwordChecker = $password_checker;
   }
 
@@ -44,7 +51,7 @@
     $uid = FALSE;
 
     if (!empty($username) && strlen($password) > 0) {
-      $account_search = $this->entityManager->getStorage('user')->loadByProperties(['name' => $username]);
+      $account_search = $this->entityTypeManager->getStorage('user')->loadByProperties(['name' => $username]);
 
       if ($account = reset($account_search)) {
         if ($this->passwordChecker->check($password, $account->getPassword())) {