Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Add Proper Support For Non-Singleton Services #2708

@Undistraction

Description

@Undistraction

Currently, there are two ways to do this:

  1. By returning some sort of Provider from Service::factory. This then leaves the dependent class to create an instance using provider.getInstance() or similar.
  2. By returning a constructor. This then leaves the dependent class to create an instance using new ServiceClass()

Both mean that the dependent class has to know that the service is non-singleton and know how to generate/create a new instance. A dependent object shouldn't know or care whether a service it depends on is a Singleton or one of many instances. This is something that should be declarable on the Service / when the service is defined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions