We start off by creating a new module called Foggyline\CatalogBundle
. We do so with the help of the console, by running the command as follows:
php bin/console generate:bundle --namespace=Foggyline/CatalogBundle
The command triggers an interactive process that asks us several questions along the way, as shown in the following screenshot:
Once done, the following structure is generated for us:
If we now take a look at the app/AppKernel.php
file, we would see the following line under the registerBundles
method:
new Foggyline\CatalogBundle\FoggylineCatalogBundle()
Similarly, the app/config/routing.yml
has the following route definition added to it:
foggyline_catalog: resource: "@FoggylineCatalogBundle/Resources/config/routing.xml" prefix: /
Here we need to change prefix: /
into prefix: /catalog/
, so we don't collide with core module routes. Leaving it as prefix: /
would simply overrun our core AppBundle
and output Hello World!
from the src/Foggyline/CatalogBundle/Resources/views...