Custom bundles versus AppBundle
When we use AppBundle
as a code base, the app/
directory of our project can be seen as part of AppBundle
. Sure, it has other files and folders that take care of other bundles available in the /vendor
directory, for example, but we can benefit a lot from the app/
folder.
For example, if you look at the MyBundle/Resources
folder, you will find two subfolders named Resources/config/
and Resources/views/
, which hold service definitions (and other required settings in the future) and template files for that bundle.
However, with AppBundle
, we already have a folder named app/
, so conveniently, we can use the available app/config
for our configuration needs and app/Resources/views
for our templates. Using this approach, referencing these files are much easier.
Compare the render()
method in indexAction()
of each controller. In the AppBundle
controller, we simply referenced the template file without mentioning the name of the bundle. When there is no bundle name, Symfony...