Why does the FOSUserBundle User entity have two properties for a username (and other fields)?
/**
* @var string
*/
protected $username;
/**
* @var string
*/
protected $usernameCanonical;
I’ve read the docs, browsed the source code, and tried to search for information, and I can’t find out why it exists. It seems to always store the same values. I’m sure there is a good reason, can someone fill me in?
Canonical fields get lowercased before comparison or search — to make sure there are no duplicates with the same value but with different case like
Test@test.organdtest@test.org.