4
votes

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

2
Please post your routing code.mattexx
@mattexx done, added to the main postReynier
you access your website through app_dev.php and read the prod.log. Doesn't this ring a bell? :Dcheesemacfly
@cheesemacfly I don't have any dev log file altough I access the URL _dev for some reason logs go to prod.log fileReynier
maybe you are not really in dev mode. Have you tried clearing your cache after making the suggested change?mattexx

2 Answers

1
votes

Change your path to "bank_homepage":

bank_homepage:
    path:  /bank_homepage
    defaults: { _controller: BankBundle:Default:index }
    requirements:
        _method: GET

Make sure you are in dev mode:

php app/console cache:clear --env=dev
0
votes

put another slash at the end of the pattern

Ex: pattern: /hello/{name}/