-
Notifications
You must be signed in to change notification settings - Fork 76
Description
Moved from symfony-cmf/Routing#90
Currently there is support for generating URLs for cmf documents using the symfony path and url twig functions but it would be nice to have a dedicated function that only generates CMF-based routes for the following reasons:
It might be better NOT to throw a RouteNotFoundException for these kind of routes because they are volatile (user's can often edit them and move them) and having this throw exceptions to the template is not desired
In a multi-domain situation these functions would ensure that routes being generated for a site other than the current one would always be generated as absolute although this logic would perhaps live in a DomainAwareGenerator
There is discussion happening around this here #178 but there is nothing stopping us from creating these functions using the current route generator rather than the chain route generator and also implementing the don't throw exceptions approach.
How should exceptions be handled? You could have a $throw boolean method in the constructor for the twig extension that is set based on the kernel.debug parameter (so it would throw exceptions in dev but not production. This might not be ideal because it would make it hard to work on a page that was throwing exceptions. Perhaps it could just log these exceptions in dev as critical errors.