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

[DX] Remove default match from AbstractConfigCommand::findExtension#17456

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
kix wants to merge1 commit intosymfony:masterfromkix:fix-find-extension

Conversation

@kix
Copy link
Contributor

@kixkix commentedJan 20, 2016

QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsnone
LicenseMIT
Doc PRnone

Previously,findExtension would return the first extension that might not even match the$name parameter, which would quite confuse the user:

$ app/console config:debug TotallyNonExistentBundle# Current configuration for "TotallyNonExistentBundle"knp_paginator:    default_options:        sort_field_name: sort        sort_direction_name: direction        filter_field_name: filterField        filter_value_name: filterValue        page_name: page        distinct: true    template:        pagination: 'KnpPaginatorBundle:Pagination:sliding.html.twig'        filtration: 'KnpPaginatorBundle:Pagination:filtration.html.twig'        sortable: 'KnpPaginatorBundle:Pagination:sortable_link.html.twig'    page_range: 5

Same problem goes for theconfig:dump command. When you dumped the config for a bundle you thought you've registered, but, for example, you'd use a name that's not exactly matching, you'd get confusing output for a different bundle's configuration.

The problem was, anExtensionwas always fetched in the finder method, and name/alias misses were ignored.

@kix
Copy link
ContributorAuthor

kix commentedJan 20, 2016

The build failure seems unrelated to this PR:https://travis-ci.org/symfony/symfony/jobs/103599240#L3252

@wouterj
Copy link
Member

What about rewriting this like:

$bundles =$this->initializeBundles();foreach ($bundlesas$bundle) {if ($name ===$bundle->getName()) {return$bundle->getContainerExtension();        }$extension =$bundle->getContainerExtension();if ($extension &&$name ===$extension->getAlias()) {return$extension;        }    }if ('Bundle' !==substr($name -6)) {$message =sprintf('No extensions with configuration available for "%s"',$name);    }else {$message =sprintf('No extension with alias "%s" is enabled',$name);    }thrownew \LogicException($message);}

@kix
Copy link
ContributorAuthor

kix commentedJan 20, 2016

@wouterj, good idea, will update the PR. I just thought it could be better if less code was rewritten, but now I have to agree your code looks better :)

@kixkixforce-pushed thefix-find-extension branch 4 times, most recently from7fd1d07 tof797e12CompareJanuary 20, 2016 13:19
Previously, findExtension would return the first extension that mightnot even match the $name parameter.
@stof
Copy link
Member

👍

@wouterj
Copy link
Member

Status: reviewed

@fabpot
Copy link
Member

Thank you@kix.

fabpot added a commit that referenced this pull requestJan 21, 2016
…Extension (kix)This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes#17456).Discussion----------[DX] Remove default match from AbstractConfigCommand::findExtension| Q             | A| ------------- | ---| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | none| License       | MIT| Doc PR        | nonePreviously, `findExtension` would return the first extension that might not even match the `$name` parameter, which would quite confuse the user:```$ app/console config:debug TotallyNonExistentBundle# Current configuration for "TotallyNonExistentBundle"knp_paginator:    default_options:        sort_field_name: sort        sort_direction_name: direction        filter_field_name: filterField        filter_value_name: filterValue        page_name: page        distinct: true    template:        pagination: 'KnpPaginatorBundle:Pagination:sliding.html.twig'        filtration: 'KnpPaginatorBundle:Pagination:filtration.html.twig'        sortable: 'KnpPaginatorBundle:Pagination:sortable_link.html.twig'    page_range: 5```Same problem goes for the `config:dump` command. When you dumped the config for a bundle you thought you've registered, but, for example, you'd use a name that's not exactly matching, you'd get confusing output for a different bundle's configuration.The problem was, an `Extension` [was always fetched in the finder method](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php#L51), and name/alias misses were ignored.Commits-------b85059a Remove default match from AbstractConfigCommand::findExtension
@fabpotfabpot closed thisJan 21, 2016
@kixkix deleted the fix-find-extension branchJanuary 21, 2016 08:30
@kix
Copy link
ContributorAuthor

kix commentedJan 21, 2016

Thanks for merging!

@fabpotfabpot mentioned this pull requestFeb 3, 2016
This was referencedFeb 28, 2016
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.

5 participants

@kix@wouterj@stof@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp