Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Conversation

@unkind
Copy link
Contributor

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?let's see
Fixed tickets#25630
LicenseMIT
Doc PR-

theofidry reacted with thumbs up emoji
@unkindunkindforce-pushed thefeature-custom-container-configurator branch 3 times, most recently from398cfdd to8d9d172CompareJanuary 2, 2018 00:49
@unkindunkindforce-pushed thefeature-custom-container-configurator branch from8d9d172 to00e830fCompareJanuary 2, 2018 00:52
@nicolas-grekasnicolas-grekas added this to the4.1 milestoneJan 2, 2018
@unkind
Copy link
ContributorAuthor

Any chance to merge it in 4.1?

It's a challenge to make it without changes in the core so far:ContainerConfigurator requiresPhpFileLoader as dependency (probably,FileLoader is enough?). /cc@nicolas-grekas

@ro0NL
Copy link
Contributor

ro0NL commentedFeb 22, 2018
edited
Loading

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 correspondingConfiguratorAwareConfigurationInterface or so?

@andersonamuller
Copy link
Contributor

Or:

$myExt =$c->extension('my_ext')->configure(function (MyExtConfigurator$myExt) {return$myExt->foo('bar');});

@ro0NL
Copy link
Contributor

ro0NL commentedFeb 22, 2018
edited
Loading

Or:

$c->extension(function(MyExtConfigurator$e) {$e->fluent('config');});

Where's my cookie? :)

andersonamuller reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedMar 23, 2018
edited
Loading

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.
Unfortunately, this is currently left as "an exercise" to bundle authors (and the exercise is not trivial).
Would be awesome to be able to somehow autogenerate it from config definition!

@nicolas-grekasnicolas-grekas modified the milestones:4.1,nextApr 20, 2018
@nicolas-grekas
Copy link
Member

@unkind can you check#27065? I think it could fix your issue in a nice way. WDYT? I'm closing this PR as explained above. Thanks for proposing.

@unkind
Copy link
ContributorAuthor

@unkind can you check#27065? I think it could fix your issue in a nice way.

Hmm, what's the difference? Closure or anonymous class?

The issue is a bit deeper than it may look.
Maintainers of bundles don't know and don't want to support this type of configuration.
I still don't see it for Monolog bundle, for example (like in my proposal here:#25630).
I'm pretty sure that simple "official" support at extension level could be nice push for them, because it's "official" way.
Just think about it like ... sales manager, not programmer. :)

Also,PhpFileLoader is still cannot be extended in user-land with custom injected file.

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.

@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

5 participants

@unkind@ro0NL@andersonamuller@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp