Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DependencyInjection] Add custom container configurators#25650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
unkind commentedJan 1, 2018
| Q | A |
|---|---|
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | let's see |
| Fixed tickets | #25630 |
| License | MIT |
| Doc PR | - |
398cfdd to8d9d172Compare8d9d172 to00e830fCompareunkind commentedFeb 21, 2018
Any chance to merge it in 4.1? It's a challenge to make it without changes in the core so far: |
ro0NL commentedFeb 22, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
What about something like $c->extension('my_ext', ['primitive' =>'config']);// vs./** @var MyExtConfigurator $myExt */$myExt =$c->extension('my_ext');$myExt ->fluent('config'); Thus support both flavors, as well as multiple extension per-config. With a corresponding |
andersonamuller commentedFeb 22, 2018
Or: $myExt =$c->extension('my_ext')->configure(function (MyExtConfigurator$myExt) {return$myExt->foo('bar');}); |
ro0NL commentedFeb 22, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Or: $c->extension(function(MyExtConfigurator$e) {$e->fluent('config');}); Where's my cookie? :) |
nicolas-grekas commentedMar 23, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm not convinced this is the approach we need in core. The idea I proposed in#25630 doesn't require any code at all, thus not any new concept/methods/api: returnfunction (ContainerConfigurator$c) {$myBundle =newMyBundleConfigurator($c);$myBundle->setWhatever();} To me, configuration is the correct place to do "new". Note that I'd also really like to be able to autocomplete bundle config using fluent configurator. |
nicolas-grekas commentedApr 26, 2018
unkind commentedOct 21, 2018
Hmm, what's the difference? Closure or anonymous class? The issue is a bit deeper than it may look. Also, YAML/XML are cool when you need to generate them, e.g. you have some kind of "hexagons" (in terms of hexagonal architecture), they have different namespaces, you have to register it for auto wiring, etc., so config generation here is perfect solution. But when you deal with manual changes, I still don't see better solution than plain PHP. |