0

I am working on a application where want to store user data in mongodb and mysql using FOSUserBundle in symfony2. Can we add more driver in configuration of FOSUserBunde in config.yml?

Need some suggestion or any other alternate.

1 Answer 1

1

have a look: http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/cookbook/blending-orm-and-mongodb-odm.html

Probably this options is not supported with fos_user_bundle, just because they need to know the driver which the bundle will work. But, by extending the fos_user BaseUser class you can add your property, like Id etc... and you can setUp some properties in mongoDb.Probably the problem is just one: you need to create a collection named:userInfo or something like that and store there the property that you need. So,you user class that extend the BaseUser has a relation to a "mongoObject" that contains the rest of the userData ( if your goal is store there simple attributes like name, surname, etc ).

I think that in this way works.

A well design, that I really want to try is using the "Embedding mapping" of doctrine: http://doctrine-mongodb-odm.readthedocs.org/en/latest/reference/embedded-mapping.html In this way you can embed the attributes in UserObject as a MongoDb document.

Remember in both cases to implement the listener for the postLoad

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.