Symfony2 bundles confusion

 
 
 
 

I am following the instructions on creating a sample application. I am trying to quickly get to grips on how to create a few (for now) static pages - no user authentication, no ORM etc, just to get something up and running.

I have created two bundles:

$ php app/console generate:bundle --namespace=app1/FooBundle --format=yml
$ php app/console generate:bundle --namespace=app2/FooBarBundle --format=yml


from the documentation (and knowledge of how Symfony 1.x worked), I expected to be able to access the two 'applications' using:

http://sf2.examples.localhost/app_dev.php/app1/hello/angrycoder
http://sf2.examples.localhost/app_dev.php/app2/hello/angrycoder


However, in both cases, I simply got a 404 error.

Upon going back to the documentation, I read that the correct URL to use was;

http://sf2.examples.localhost/app_dev.php/hello/angrycoder


That seems to 'work' in so far as a page with angrycoder was displayed.

HOWEVER - I have no idea which application has actually been called - since I haven't yet figured out how to display the debug toolbar.

My question therefore is this:


How do I get to a specific page (static or otherwise) in a given bundle?.


[[Edit]]

This is what my app/config/routing.yml file looks like:

app1CoreBundle:
resource: "@app1CoreBundle/Resources/config/routing.yml"
prefix: /

app2CoreBundle:
resource: "@app2CoreBundle/Resources/config/routing.yml"
prefix: /

# Internal routing configuration to handle ESI
#_internal:
# resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
# prefix: /_internal


As can be seen, both have a prefix of '/'. So when I type:

http://sf2.examples.localhost/app_dev.php/hello/angrycoder


Which application is actually called (and why?).

From my understanding, the only (obvious way) to be able to call specific applications - is to use different prefixes for different applications - or am I missing something?

Read Full Article

 
 
 
 
 
 
 
 

Related presentations

 
 
 
 
 
Want to support this service?