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

[Config] Add ConfigurableArrayLoader#21070

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

Closed
ro0NL wants to merge1 commit intosymfony:masterfromro0NL:config/array-loader
Closed

[Config] Add ConfigurableArrayLoader#21070

ro0NL wants to merge1 commit intosymfony:masterfromro0NL:config/array-loader

Conversation

@ro0NL
Copy link
Contributor

@ro0NLro0NL commentedDec 27, 2016
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes/no
Fixed tickets#...
LicenseMIT
Doc PRsymfony/symfony-docs#...

Tiny snippet, that bridgesConfig\Definition withConfig\Loader, by providing a convenient base classConfigurableArrayLoader to users (comparable to the currentConfigurableExtension).

Would be nice if we considered renamingFileLoaderLoadException toLoaderLoadException (or given the package context justLoadException perhaps), to be semantically correct here.

@nicolas-grekas
Copy link
Member

What's the use case?

@ro0NL
Copy link
ContributorAuthor

ro0NL commentedDec 28, 2016
edited
Loading

Bridging :) without bothering users about implementation details, allowing to write loaders simpply and focus on business value;

class MyBaseLoaderextends ConfigurableArrayLoader {protected$target;publicfunction__construct(Domain$target) {parent::__construct(newBusinessConfiguration());$this->target =$target;    }}class MySpecialJsonLoaderextends MyBaseLoader {publicfunctionload($file) {returnparent::load(json_decode(file_get_contents($file));    }protectedfunctionloadConfiguration(array$config) {$this->target->setBusiness($config['business']);    }}

@nicolas-grekas
Copy link
Member

But users don't write loaders, that's not a business responsibility...

@ro0NL
Copy link
ContributorAuthor

True, but it depends how the user relies onSF\Config, it may not be using DI loaders etc.

@ro0NL
Copy link
ContributorAuthor

Anyway, ill have no strong use case myself now. Just trying to make lib code more robust and easier to understand/implement.

@nicolas-grekas
Copy link
Member

Adding more code is not going to make it easier to understand IMHO...

@ro0NL
Copy link
ContributorAuthor

ro0NL commentedDec 28, 2016
edited
Loading

Agree, not per see. Just saying (from a component pov) i could appreciate having this kind of self-bridging classes, doing things once; exposing patterns; exposing business value.

@fabpot
Copy link
Member

I agree with@nicolas-grekas. We never add a feature without a real-world use case. So, I'm closing this PR for now.

@fabpotfabpot closed thisDec 28, 2016
@ro0NLro0NL mentioned this pull requestDec 28, 2016
@ro0NLro0NL deleted the config/array-loader branchDecember 31, 2016 12:52
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

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@ro0NL@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp