1
votes

First of all, I'm new in Symfony2 and I'm developing an app with it.
This is a Portfolio, here's my hierarchy:

I want to create my own back office.

/src
----/Antoine
--------/PortfolioBundle
------------/Controller
----------------ProjectsController.php
------------/Resources
----------------/config
--------------------routing.yml
--------------------routing_admin.yml ?
--------/UserBundle
------------/Controller
----------------DefaultController.php
------------/Resources
----------------/config
--------------------routing.yml
--------------------routing_admin.yml ?

Should I :
- Put admin Actions in each controllers (ex: ProjectsController:addAction())
- Create an AdminController in each bundles
- Create a Bundle named AdminBundle (I don't like it)

If I want to prefix all admin routes by /admin, then should I create a admin_routing.yml in each bundle and include it in each routing.yml of each bundle with prefix /admin ?

Thank you for your time.

1

1 Answers

0
votes

Should I :

  • Put admin Actions in each controllers (ex: ProjectsController:addAction())

No. That would give trouble with your method-names and it is confusing

  • Create an AdminController in each bundles

Yes or more then one AdminController. For example:

  • DefaultAdminController
  • ProjectsAdminController

etc

  • Create a Bundle named AdminBundle (I don't like it)

If you directly create admin pages and you reuse your Entities and maybe a few other classes then your AdminBundle wouldn't be independent as it should.

Besides that you could take a look at the Sonata admin bundle. Here you can learn how they built an AdminBundle that is totally decoupled