On Fri, 25 Feb 2011 17:59:17 +0200, [email protected] wrote: > I took a look into RouteCompiler.php code and noticed that > functionality could be implemented not that hard. Just by throwing in > some additional settings array, where you could set which placeholders > are optional, and instead wrapping them like that: > /(?P<placeholdername>placeholderregex) > do this way for optional placeholder: > (?:/(?P<placeholdername>placeholderindex))? > > > On Fri, Feb 25, 2011 at 12:30 PM, <[email protected]> wrote: >> Hey, >> I encountered big limitation of routing patterns today. >> >> Use case: >> We need to be able to show article in 2 languages, with optional >> requirement to have culture placeholder in url. >> Right now pattern would look like this: >> /articles/{culture}/{year}/{title}.{_format} => >> /articles/en/2011/nicearticle.html >> However this limits having culture in url, it is not possible to have >> url like this, and e.g. load culture from session/cookie or geoip >> database: >> /articles/2011/nicearticle.html >> >> I see 2 solutions now: >> 1. Regex support in pattern setting which would allow to solve this >> easily and would add more flexibility. >> 2. Fallback pattern support (this sounds ugly). >> >> -- >> Aurelijus ValeiĊĦa >> +370-618-19765 >>
The issue would be routes with several optionnal placeholder. If you have two optionnal placeholders and provide only one, which one should match and which one should use its default value ? The current implementation allows to match optionnal placeholders at the end ( /articles/en/2011/nicearticle would match the pattern provided by Aurelijus without the dot spearator if the _format placeholder is optionnal) so the rule is easy to understand: the omitted placeholder is the last one. But allowing to omit any placeholder will make matching ambiguous. -- 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 developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
