rollerworks-graveyard / RollerworksMultiUserBundle

Multi user management for the FOSUserBundle - DISCONTINUED!!
MIT License
56 stars 21 forks source link

How to overwrite FOSUser config to use mongodb as defaut model manager #31

Closed Marchello74 closed 10 years ago

Marchello74 commented 10 years ago

I use mongodb everything go well but i can't validate registration form, it show me this error Unable to find the object manager associated with an entity of class "Acme\UserBundle\Document\User" Someone has an idea?

sstok commented 10 years ago

It seems we hit a bug here, the default driver delegated to FOSUser is orm. So it does not load the mongodb driver, to fix this (actually supporting multiple drivers) the UserServicesFactory needs to be updated that that it always registers the user manager explicitly (and does not depend on the default).

For now you can use this workaround. Add the following to your app configuration. This will enable the mongodb driver for FOSUser, but you can't load another driver for a usersystem then mongodb.

fos_user
    db_driver: mongodb 
Marchello74 commented 10 years ago

Thanks for your response but when i done it i had this error

Configuration path "fos_user.db_driver" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section

What can ' do ?

sstok commented 10 years ago

I added a temporary workaround.

Update to the latest version, and add/change this to/in your app configuration.

rollerworks_multi_user:
    db_driver: mongodb 
Marchello74 commented 10 years ago

The update fail and i had this error

The service "doctrine_mongodb.odm.default_configuration" has a dependency on a non-existent parameter "doctrine_mongodb.odm.default_commit_options". Did you mean one of these: "doctrine_mongodb.odm.default_connection", "doctrine_mongodb.odm.default_document_manager"?

can you give me your mongodb config please?

what should i do before update

sstok commented 10 years ago

Hhmm, that does not seem to be related to this bundle. Can you try just the FOSUserBundle an see if the problem persists?

Marchello74 commented 10 years ago

That is ok it was mongodb-bundle thanks

sstok commented 10 years ago

Good news, I found out what is causing the original failure and how to fix its.

The FOSUserBundle only loads the mapping for one db-driver, so using another driver will not load the mapping for 'that' driver, which is causing the mapping error.

Second to this the UserListener is not properly overloaded which can result in canonical fields not being updated. So fix this properly I have come up with the following.