Le 09/05/2011 14:18, keymaster a écrit :
> by default, the console run in dev environment. You need to use
--env=prod
Bingo. That was exactly that piece of info I was missing.
php app/console -env=prod cache:clear
Routing is now working as expected.
Thank you very much for your help Christophe.
I'll try and summarize for anyone else who reads this after me, in the
hope it helps someone.
SUMMARY
If you have app_dev.php in your url, Symfony2 will use the development
environment. Since Symfony2 clears the development cache automatically
on every code change, as soon as you add a new route, it will be
recognized.
If you have app.php in the url, or nothing at all, Symfony2 defaults
to the production environment - even if you are running on your
development box. In the production environment, new routes will not be
recognized until you clear the production cache.
To be clear: the file *defines* the environment. And the rewrite rule
provided by default rewrites the urls to the app.php file which means to
the prod environment.
Clearing the cache in the CLI without any options in the command,
clears the development cache, not the production cache. If you want to
clear the production cache (which you need to do if you add a new
route, or other things which are cached, and you want to go to the
site without app_dev.php in the url), you have to add -env=prod to the
cache:clear on the CLI,like this:
php app/console -env=prod cache:clear
CONCLUSION
It seems while you are developing, for simplicity, you should keep
app_dev.php in your urls, always. If you want to work without
app_dev.php in your urls, make sure to clear the production cache
explicity, by adding -env=prod to the CLI command.
Exactly. The dev environment is meant to be used when developing.
I may have missed it, but I don't think the documentation spells this
idea out so clearly.
Hope this helps someone.
Thanks, Christophe for all your assistance.
It's people like you which really build a successful community.
--
If you want to report a vulnerability issue on symfony, please send it
to security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
--
Christophe | Stof
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en