Organize Files in SonataAdminBundle: What's Happening?

I have gathered the following information from several examples in the documentation SonataAdminBundle

. Please correct me if there are some errors, but here is what I get in case BlogBundle

:

Frontend and Backend files are mixed in the same bundle

As you can see, in general, each bundle contains the frontend

and classes backend

.

It seems very messy to mix both frontend

and backend

in the same folders (see Controllers), but honestly I can't think of it in a different way ...

I actually started to handle the backend in a separate bundle, but then I realized that it was too messy too.

So in practice, do people really follow this architecture? Is this the only / best way to handle the backend when using SonataAdminBundle?

This beautiful post here takes a different approach ... any ideas I should be doing to make sure the code doesn't end up being too messy.

+3


source to share


1 answer


Simple: Use folders in mixed content locations. I add frontend components directly to their respective folders and add Admin folders for backend files.

You can refer to, for example, a controller in the Admin subfolder like this BlogBundle:Admin\Concert:index

, in fact the same works for templates.



In config, you can create a file config-frontend.yml

and config-backend.yml

then include it in the source file config.yml

. I do not do this.

+2


source