See http://symfony.com/doc/current/components/dependency_injection/parentser...

Credits to @dawehner for finding this.

The attached patch (following in comment) shows this using plugin managers. There are some problems, we use constructor injection, so we can't just change a single argument easily (e.g. different cache bin) or add another one. We could change some of the other plugin managers to use setter injection instead, though. And for cache, we could just unify them to use all the same cache bin, possibly introduce a cache.plugin, which could be a cache collector (see #2064511: Use a cache collector to combine related plugin caches)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Status: Active » Needs review
FileSize
5.2 KB

Here we go.

dawehner’s picture

FileSize
11.76 KB

Here is the approach I went with, so I guess we should leverage the patch from berdir and sort of use the other one for views?

dawehner’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: +DX (Developer Experience)

I do way more like the patch from berdir, RTBC to that one.

tim.plunkett’s picture

Hiding the other patch so it is clearer that Berdir's patch is the RTBC one

Berdir’s picture

There are more examples that could be simplified with this approach, cache bins for example. They only differ in the argument that's passed to the cache factory.

Do we want to get this in as an example and open a follow-up (meta?) issue to use it in other places?

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Wicked. This patch is very nice. Nice that the Symfonic folks already thought of this, and we can just use what they do.

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.