FOSFacebookBundle + FosUserBundle Email exist in the BDD FOSFacebookBundle + FosUserBundle Email exist in the BDD symfony symfony

FOSFacebookBundle + FosUserBundle Email exist in the BDD


In controller you can check whether email exists in DB or not using fos user bundle user manager

$user = $this->get('fos_user.user_manager')->findUserByEmail($email);

After user confirms, you can use implemented facebook provider to do necessary action.

between,I have a question for you,

"If the answer is no, I create a new user in the DB and log in."

how do you create a new user with same email (assuming email is unique)?