FOSUserBundle: what is the point?

I've seen many people trying to use FOSUserBundle.

I've been struggling with it for 6 hours now. Just to be able to make a custom user registration form. The basic documentation is 6 pages long: basic. Here are all the drawbacks of using FOSUserBundle, from my point of view:

  • you have to copy paste their views to make inheritance possible
  • they have their own table on the database: fos_user . So you have to base all your code on your user entity, which a child of BaseUser . If your database follows a convention (like wordpress does, with all tables beginning with wp_ ) this breaks your convention.
  • you have to hack all you own views with things like "if the fos_user_content block is empty i suppose there's nothing to display, otherwise i have to re-organize my whole view to display the fos_user_content block (registration, modify user profile and so on)"
  • and now I see that if you need two different registration forms (for example, one for client, one for partners) it's not possible unless you hack. See here.
  • So I'm just wondering: what is the point of using if FOSUserBundle? If I've already done a registration process that follows the very basic things explained in Symfony help (forms, form validation, and sessions) and I just copy paste my code, this is, from my point of view, far faster than installing, configuring, inheriting, modifying and so on the FOSUserBundle.

    Knowing what I've done, what are the advantages of FOSUserBundle? What could make me change and take some more hours to make it work with my project, instead of re-using my (forms, form validation, and sessions) from another project?


    Well, your question sounds more like a rant, but you got some points.

    In my opinion, the main problem of the FOSUserBundle as well as a lot of Bundle in the community, is that they try to make it customizable, generic, re-usable, whatever.

    The goal is fair, but in reality it often leads to not human friendly code. Most of the time, you will take much more time to "get it done" using community bundle than making your own (see Sonata bundles).

    I don't say they are bad bundles, not at all, but they deserve different purposes .

    For me such bundles may help newcomers to have a quick implementation, to get things done , and in the case of a Rapid Application Development , it may be really easy to get a fully working application with all the registration process done.

    But most of the time, you realize that using third party codes ties you too much to their own concept and that is wrong.

    In comparison, I do like very much the npm community, there are A LOT of little package with one function which you can easily integrate, in the same way, I try, to favor library instead of bundle when I want to release an open source project. The point is the framework implementation is free of any concept or philosophy and easily integrate in an existing project.

    I remember some early days where I had to play with Joomla, Drupal, Wordpress, whatever, it was the "plugin/extension/module" fashion, in the same way that we often hear "there is a bundle for that", some people, or company just want to get it done, no matter the quality, the future of the application because it already have been sold.

    To conclude, such bundles can greatly help and speed up development process, but be careful, if you have custom requirements, performance implication, etc. don't use them, however if you only want to a quick proof of concept, or a simple application, it is worth.

    This is a fiction story based on my own experience and failures using it :)

    链接地址: http://www.djcxy.com/p/16326.html

    上一篇: 使用std:vector作为低级缓冲区

    下一篇: FOSUserBundle:有什么意义?