I have created a bundle using the command php app/console generate:bundle
this add the bundle in /app/AppKernel.php
and also in /app/config/routing.yml
. If I try to access the URL http://devserver/web/app_dev.php/bank_homepage
I got a 404 error. I check /app/logs/prod.log
and see this:
[2013-07-29 13:41:27] request.ERROR: Uncaught PHP Exception
Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No
route found for "GET /web/app_dev.php/bank_homepage"" at
/var/www/html/app/cache/prod/classes.php line 1880
{"exception":"[object]
(Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No
route found for \"GET /web/app.php/bank_homepage\" at
/var/www/html/app/cache/prod/classes.php:1880,
Symfony\Component\Routing\Exception\ResourceNotFoundException: at
/var/www/html/app/cache/prod/appProdUrlMatcher.php:1222)"} []
What I'm doing wrong?
This is my /app/config/routing.yml
bank:
resource: "@BankBundle/Resources/config/routing.yml"
prefix: /
....
And this is my /src/BankBundle/Resources/config/routing.yml
bank_homepage:
pattern: /hello/{name}
defaults: { _controller: BankBundle:Default:index }
requirements:
_method: GET
EDIT some tests
I change the URL from http://devserver/web/app_dev.php/bank_homepage
to http://devserver/web/app_dev.php
and then the error changes to this:
[2013-07-29 14:22:15] request.ERROR: Uncaught PHP Exception
Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No
route found for "GET /web/app_dev.php"" at
/var/www/html/app/cache/prod/classes.php line 1880
{"exception":"[object]
(Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No
route found for \"GET /web/app_dev.php\" at
/var/www/html/app/cache/prod/classes.php:1880,
Symfony\Component\Routing\Exception\ResourceNotFoundException: at
/var/www/html/app/cache/prod/appProdUrlMatcher.php:1222)"} []
Which practically is the same
PS: I check (this)[No route found for "GET /portfolio but this didn't work for me
Best Answer
Change your path to "bank_homepage":
Make sure you are in dev mode: