Question

I am quiet new to the symfony framework and took some lessons and purchased the 'Starting in Symfony2' tutorial from knpuniverse. I want to be sure that I use the correct setup for my application. My question is, How do you call your first central bundle? eg. FrontendBundle? I want to make the next structure in my application:

  • FrontendBundle
    • The front where people get a landing site where they can also login

from there, when they login, they get into the next bundle:

  • CustomerBundle
    • Backend app where customers get their invoices and pay them and edit their information we stored in the database

And at least:

  • AdminBundle
    • Another backend app where I can edit customers, make invoices for customers and edit the app information

Is this the correct way and is FOSUserBundle a good bundle for this kind of application?

Was it helpful?

Solution

Bundles have sense only if they can be used in "multiple projects". I mean: if you write code, make it as a bundle and you can't reuse that bundle (for example because bundles, as you described above, are strictly and logically connected to your project) this three bundle separations is totally useless.

So, final answer (that is also a question) is:

Could you reuse FrontendBundle in other projects?
Could you reuse CustomBundle in other projects?
Could you reuse AdminBundle in other porjects?

If you notice that you can't use any or all of these bundles for other project, maybe this separations isn't good.

Why I say that?

Because if they can't be used in separated ways is likely that they should be used togheter so you should keep them togheter.

So I advice to keep them into a single bundle (YourNameYourBundleNameBundle (in that notation, for example)) and to separate the single "areas":

  • FrontEnd controllers/entities/views
  • Custom controllers/entities/views
  • Admin controllers/entities/views

OTHER TIPS

This problem has been discussed at length already. For application specific code either do a single AppBundle or don't use bundles at all.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top