Reputation: 12069
I have a fresh isntalation of Symfony 2.4 + FOSUserBundle. I just configured FOSUserBundle, this guide: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md
Now I try to create a new user with the CLI
fos:user:create --super-admin user [email protected] password1
And I get this error
PHP Fatal error: Cannot instantiate abstract class FOS\UserBundle\Model\User in /var/www/symfony2/vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Model/UserManager.php on line 55
config.ylm
...
fos_user:
db_driver: propel
firewall_name: main
user_class: FOS\UserBundle\Model\User
...
When access /register I get the same error, but /login seems to work fine (although I cant login, since I have no users)
Any ideas? Thanks in advance
EDITS:
new user class:
namespace g9\BoBundle\Model;
use FOS\UserBundle\Model\User as MyUser;
use FOS\UserBundle\Model\UserInterface;
use FOS\UserBundle\Model\UserManager;
class User extends MyUser {
# .. no code here yet
}
When I use CLI to create user I get:
[InvalidArgumentException]
This user instance is not supported by the Propel UserManager implementation
Should I submit another question? (The initial question got an answer
Upvotes: 0
Views: 2037
Reputation: 9246
You can't use provided User model, you have to extend it and create your own.
When you do that, set user_class
configuration parameter to namespace of your User model (which extends FOSUser's one).
At the moment, your user_class
is set to their abstract User
and therefore it breaks.
Upvotes: 3