phillipsnick / nickphillips.co

Source for nickphillips.co
MIT License
0 stars 0 forks source link

SF2 - FOSUserBundle - Ability to drop username fields #45

Open phillipsnick opened 10 years ago

phillipsnick commented 10 years ago

Potential hack found here https://github.com/FriendsOfSymfony/FOSUserBundle/issues/555#issuecomment-59510228

Some details on using the event listeners here https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/controller_events.md

phillipsnick commented 10 years ago

As username can't be null a quick fix has been added to the user entity

    public function setEmail($email)
    {
        if (is_null($this->getUsername())) {
            $this->setUsername(uniqid());
        }

        return parent::setEmail($email);
    }
phillipsnick commented 10 years ago

Also investigate dropping from sonata table See about overriding vendor/sonata-project/user-bundle/Admin/Entity/UserAdmin.php

phillipsnick commented 10 years ago

http://m2mdas.github.io/blog/2013/11/18/integrate-fosuserbundle-and-sonatauserbundle-easily/