getUsername() is deprecated. It has to be replaced with getDisplayName()
For reference,
https://api.drupal.org/api/drupal/core!modules!user!src!Entity!User.php/...

I have provided the patch in which all getUsername() functions are replaced with getDisplayName()

Comments

deepaligaurkar created an issue. See original summary.

deepaligaurkar’s picture

Status: Active » Needs review
StatusFileSize
new1 KB

Please find attached patch.

Status: Needs review » Needs work

The last submitted patch, 2: 3037851-02-replace-getUsername.patch, failed testing. View results

deepaligaurkar’s picture

StatusFileSize
new994 bytes

Updated patch for the error.

deepaligaurkar’s picture

Assigned: deepaligaurkar » Unassigned
Status: Needs work » Needs review
laravz’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for your work!

The patch applied cleanly to the latest dev and stable versions and does as stated by the deprecation instructions (Use \Drupal\Core\Session\AccountInterface::getAccountName() or \Drupal\user\UserInterface::getDisplayName() instead).

npralhad’s picture

The patch in #4 worked perfectly on local environment.

deepaligaurkar’s picture

Assigned: Unassigned » deepaligaurkar

  • Berdir committed 9c194d7 on 8.x-1.x authored by deepaligaurkar
    Issue #3037851 by deepaligaurkar, LaravZ: Replace deprecated method...
berdir’s picture

Status: Reviewed & tested by the community » Fixed

Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

deepaligaurkar’s picture