Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FOSUserBundle: username vs usernameCanonical

Tags:

php

symfony

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?

like image 882
Chris Tickner Avatar asked Dec 15 '11 01:12

Chris Tickner


1 Answers

Canonical fields get lowercased before comparison or search — to make sure there are no duplicates with the same value but with different case like [email protected] and [email protected].

like image 145
Elnur Abdurrakhimov Avatar answered Sep 18 '22 18:09

Elnur Abdurrakhimov