4

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

Reynier
  • 2,420
  • 11
  • 51
  • 91

2 Answers2

1

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
mattexx
  • 6,456
  • 3
  • 36
  • 47
  • It looks like you are not in dev mode. Try switching to dev mode as above. I also changed "prefix" to "path" in my answer, bit not sure if that will do anything. – mattexx Jul 29 '13 at 18:57
  • nothing still not working, I check `app/logs` directory after run the command suggested by you and logs are just one `prod.log`, what thing is causing my project stay out of `dev` enviroment? – Reynier Jul 29 '13 at 19:01
  • I don't know, this is weird. Is your apache site pointed at symfony_root or symfony_root/web ? – mattexx Jul 29 '13 at 20:07
  • @matexx I found the error, yes the problem was Apache Virtual Hosting it was pointing to another place – Reynier Jul 29 '13 at 20:12
  • Great! can you GET /bank_homepage now? – mattexx Jul 29 '13 at 20:14
  • yes, I can GET `/bank_homepage` I'm dealing with Twig and CSS and JS from my bundle but I'll open another topic for this, thanks for your support and time – Reynier Jul 29 '13 at 20:18
1

put another slash at the end of the pattern

Ex: pattern: /hello/{name}/