symfony/symfony — pull request #7722 by Inori (2013-04-19 13:01:05+00:00)
Title: [2.3][FrameworkBundle][Templating] Generate assets with absolute url

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #5322
| License | MIT
| Doc PR | -

This adds support for `asset_url` helper function, which returns asset absolute url, matching schema, host & port with server one.

Relies on `RequestContext` class, so if request is made from CLI then `router.request_context.*` parameters are needed.

I've also added package alias called `absolute_url`, so a developer can use it inside `asset` function.
I think it's useful when `assets_base_urls` parameter is used on production and simple absolute url is needed on dev.
Then a twig variable can be used, defined to be `absolute_url` on dev or `null` on prod.