Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0.0-beta16
Description: 

User::getUsername() is deprecated, use User::getAccountName() or User::getDisplayName() instead.

Case: You want to fetch the data stored in the database:

$logger->log('%user logged in', ['%user' => $user->getAccountName()]);

Case: You want to show a username

$user->getDisplayName();
Impacts: 
Module developers

Comments

Daniel Schaefer’s picture

I've tried to use it one of my template files but it wouldn't work.

{{ 'Welcome, @username'|t({ '@username': User::getDisplayName() }) }}

neither does

{{ 'Welcome, @username'|t({ '@username': user.name }) }}

Any tips?