FOSUserBundle stores canonicalized versions of the username and the email
which are used when querying and checking for uniqueness.
The default implementation simply makes them case-insensitive to avoid having
users whose username only differs because of the case. It uses
to achieve this result.
If you do not have the mbstring extension installed you will need to define your own canonicalizer.
Replacing the canonicalizers¶
If you want to change the way the canonical fields are populated, simply
create a class implementing
and register it as a service:
1 2 3 4 5
# app/config/services.yml services: app.my_canonicalizer: class: AppBundle\Util\CustomCanonicalizer public: false
You can now configure FOSUserBundle to use your own implementation:
1 2 3 4 5 6
# app/config/config.yml fos_user: # ... service: email_canonicalizer: app.my_canonicalizer username_canonicalizer: app.my_canonicalizer
You can of course use different services for each field if you don't want to use the same logic.
The default implementation has the id
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.