Skip to content

[Templating] Assets Helpers + scope request vs. CLI #8915

@MattKetmo

Description

@MattKetmo

I've notice that once you use different URLs for http & ssl assets_base_urls, the scope of templating.helper.assets is set to "request" (link to code). I understand this behavior (the service has to known which url to serve according to current request scheme), but it blocks me when I need to render a template which use the {{ asset() }} method in CLI, because You cannot create a service ("templating.helper.assets") of an inactive scope ("request").

Here is a simple PoC : MattKetmo/symfony-standard@master...assets-cli

I may expect in this condition that the base url fallbacks to one the the given url (for instance the http one). I tried to look at the templating package system, but in any case, the asset method directly use the "request-scoped service" so that's not a solution.

Is there any recommendation about the use of the "templating.helper.assets" service in CLI when it goes to the request scope?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions