8000 [RFC][Framework-Bundle] Make an Application available as a container service · Issue #29325 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to conten 647F t
[RFC][Framework-Bundle] Make an Application available as a container service #29325
Closed
@edefimov

Description

@edefimov

Some use-cases require to inject an instance of Symfony\Component\Console\Application class into arbitrary service.

Example use-case: there is a daemon based on symfony console component which can run workers. Each worker is a container service. Some workers can run arbitrary application commands inside the separated process (as an example of such a command is consuming messages). To run a command worker needs an instance of Application.

<service id="App\Worker\SomeWorker">
    <argument type="service" id="Symfony\Component\Console\Application" />
</service>

<!-- or -->
<service id="App\Worker\SomeWorker">
    <argument type="service" id="application" />
</service>

This feature will also reduce complexity of adding custom helper sets by defining them as services and injecting them into Application service using CompilerPass.

<service id="App\Console\HelperSet\MyHelper">
    <tag name="console.helper_set" helper="my" />
</service>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0