Skip to content

[RFC][Framework-Bundle] Make an Application available as a container service #29325

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy