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

6
  • Please post your routing code. Commented Jul 29, 2013 at 18:24
  • @mattexx done, added to the main post Commented Jul 29, 2013 at 18:29
  • 1
    you access your website through app_dev.php and read the prod.log. Doesn't this ring a bell? :D Commented Jul 29, 2013 at 18:44
  • @cheesemacfly I don't have any dev log file altough I access the URL _dev for some reason logs go to prod.log file Commented Jul 29, 2013 at 18:47
  • maybe you are not really in dev mode. Have you tried clearing your cache after making the suggested change? Commented Jul 29, 2013 at 18:48

2 Answers 2

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
Sign up to request clarification or add additional context in comments.

6 Comments

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.
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?
I don't know, this is weird. Is your apache site pointed at symfony_root or symfony_root/web ?
@matexx I found the error, yes the problem was Apache Virtual Hosting it was pointing to another place
Great! can you GET /bank_homepage now?
|
1

put another slash at the end of the pattern

Ex: pattern: /hello/{name}/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.