Skip to content

[DependencyInjection] Drupal needs ability to register parameterized fallback service definitions #3875

@effulgentsia

Description

@effulgentsia

Hi. I'm one of Drupal 8's core developers exploring how we can best use Symfony's ContainerBuilder. In general, I really like it.

One thing I'd like to use it for is to replace our current cache() function. We have other similar use-cases, but this one demonstrates the essentials. The key feature needed here is the ability to return a different service object for each "bin" without needing to define every bin individually.

Here's some work in progress code that demonstrates the idea I have in mind:
https://gist.github.com/2358766

While we can add the above class to Drupal, I'm wondering two things:

  1. Is this something that's of interest to Symfony, and if so, is it possible for it to make it into 2.1 (I'm happy to spend time refining it based on any feedback)?
  2. If not of interest to Symfony, do you think it's a flawed approach in general, and if so, do you have suggestions for another approach we should consider?

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