Skip to content

Service instantiation via another service #8

@eledhwen

Description

@eledhwen

Similarly to what can already be done with static method calls, it should be made possible to instantiate a service by calling an instance method.

So, for the recall, a direct declaration looks like this, it will create an instance using a constructor with the provided arguments:

my_service:
    class: "com.mypackage.MyClass"
    constructor:
        - "some_argument"
        - 123

A static method declaration looks like this, it will call the someMethod method over the MyClass class with the provided arguments:

my_service:
    class: "com.mypackage.MyClass"
    method: "someMethod"
    arguments:
        - "some_argument"
        - 123

In the same spirit, instance method declaration could look like this:

my_service:
    service: "@my_other_service"
    method: "someMethod"
    arguments:
        - "some_argument"
        - 123

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions