2
votes

Actually I have five simple projects based on Symfony 2.0. Each project has user management using Doctrine ORM.

Among bundles, User class has very few differences. Bundle1 may add "business name" attribute, Bundle2 may add "inbound communications" relationship. But all share the same well known attributes like "salt", "password", "username", "roles" and so on. And of course some logic for searching users.

Question is what's a reasonable approach to unify the user management? I mean creating a reusable UserBundle. I'm looking for some advice about xml configuration, mapped super classes, services, entity and forms inheritance.

I've looked at FOSUserBundle, it looks a bit complicated for me. I can't fully understand its logic. I don't need templates and views because each of my five bundles handles that. And I prefer to code it by myself.

1

1 Answers

1
votes

I've looked at FOSUserBundle, it looks a bit complicated for me. I can't fully understand its logic. I don't need templates and views because each of my five bundles handles that. And I prefer to code it by myself.

You're answering your question yourself, embedding the pros and cons.

Pros:

  • Reusable code makes development faster

Cons:

  • Reusable code is often more generic and lead to more complicated things to solve problems.

If you're working in a team which often develop projects involving an User Management, then it is totally valuable to make your own.

Most of the released bundles were initially developed for personal use.

If you know you're not gonna work with anything else than Doctrine2 you can bypass the part abstracting the thing to make it work with MongoDb for example.

If you do so, keep in mind that it will be shared amongst other developers while being used by co-workers which use the same technology as you do.

If you're alone, make it fit your needs.