Entity/User.php
public function setEmail($email)
    {
        $email = is_null($email) ? '' : $email;
        parent::setEmail($email);
        $this->setUsername($email);

        return $this;
    }
public function setEmail($email)
    {
        $email = is_null($email) ? '' : $email;
        parent::setEmail($email);
        $this->setUsername($email);

        return $this;
    }
public function setEmail ( $ email ) { $ email = is_null ( $ email ) ? '' : $ email ; parent :: setEmail ( $ email ) ; $ this -> setUsername ( $ email ) ; return $ this ; }
Set email
Also sets the username to the email

@param string $email
@return User
Set email Also sets the username to the email