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

[FrameworkBundle][HttpKernel] Fix resources loading for bundles with custom structure#21113

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

Merged
fabpot merged 1 commit intosymfony:2.7fromchalasr:kernel/bundle_metadata
Jan 4, 2017

Conversation

@chalasr
Copy link
Member

@chalasrchalasr commentedDec 31, 2016
edited
Loading

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#18563
LicenseMIT
Doc PRn/a

This fixes twig/translator/validator/serializer resource loading for bundles overridingBundle::getPath(), adding a kernel parameter containing the bundle metadata (i.e.path,namespace andparent).

Fixes#18563 and unlocks#19586

ro0NL, Koc, ogizanagi, and linaori reacted with thumbs up emojiwouterj reacted with heart emoji
@chalasrchalasr changed the title[FrameworkBundle] Fix resources loading for bundles with custom structure[FrameworkBundle][HttpKernel] Fix resources loading for bundles with custom structureDec 31, 2016
@ogizanagi
Copy link
Contributor

I hope this can be accepted as a bugfix rather than a new feature though :/

@xabbuh
Copy link
Member

The minimum required version of the HttpKernel component in the FrameworkBundle must be updated from~2.7.15|~2.8.8 to~2.7.23|~2.8.16.

chalasr reacted with thumbs up emoji

@chalasr
Copy link
MemberAuthor

@xabbuh thanks, done

$reflection =new \ReflectionClass($class);
if (is_dir($dir =dirname($reflection->getFileName()).'/Resources/translations')) {
foreach ($container->getParameter('kernel.bundles_metadata')as$name =>$bundle) {
if (is_dir($dir =dirname($bundle['path']).'/Resources/translations')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Callingdirname() here (and in all places below) looks wrong to me as thepath key should already just refer to directory in which the bundle is stored.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

indeed, fixed

Copy link
Member

@xabbuhxabbuhDec 31, 2016
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybe it would be good to have a dedicated test case working with a bundle that follows the default behaviour (i.e. extending the baseBundle class without overriding thegetPath() method) to detect a similar issue in the future?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sorry, I missed this comment. I think the test you have in mind already exists, the one added here is a copy paste:https://github.com/symfony/symfony/pull/21113/files#diff-b0c828e732d3d31f0b2bfb2378bd1011R340
Correct me if I'm wrong

@chalasrchalasrforce-pushed thekernel/bundle_metadata branch 2 times, most recently from1582a32 to332aeb8CompareDecember 31, 2016 14:30
@chalasr
Copy link
MemberAuthor

Tests are green


foreach ($this->bundlesas$name =>$bundle) {
$bundles[$name] =get_class($bundle);
$bundlesMetadata[$name] =array('parent' =>$bundle->getParent(),'path' =>$bundle->getPath(),'namespace' =>$bundle->getNamespace());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

To make this more readable I would change the code style to this:

$bundlesMetadata[$name] =array('parent' =>$bundle->getParent(),'path' =>$bundle->getPath(),'namespace' =>$bundle->getNamespace(),);

@xabbuh
Copy link
Member

👍

Status: Reviewed

@chalasrchalasrforce-pushed thekernel/bundle_metadata branch 2 times, most recently fromfc6afb3 to278186fCompareJanuary 2, 2017 12:33
@nicolas-grekasnicolas-grekas added this to the2.7 milestoneJan 2, 2017
@chalasrchalasrforce-pushed thekernel/bundle_metadata branch 2 times, most recently froma4b54c0 toe29fdf9CompareJanuary 4, 2017 08:54
@xabbuh
Copy link
Member

ping @symfony/deciders

@stof
Copy link
Member

stof commentedJan 4, 2017

This should also update the TwigBundle path registration

@chalasrchalasrforce-pushed thekernel/bundle_metadata branch 2 times, most recently fromcd5c429 to6ba13a9CompareJanuary 4, 2017 18:14
@chalasr
Copy link
MemberAuthor

@stof done

"twig/twig":"~1.28|~2.0",
"symfony/http-foundation":"~2.5",
"symfony/http-kernel":"~2.7"
"symfony/http-kernel":"~2.7.23"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This forbids using 2.8, you should add|~2.8.16.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

fixed

@chalasrchalasrforce-pushed thekernel/bundle_metadata branch from6ba13a9 tofef3146CompareJanuary 4, 2017 19:27
@fabpot
Copy link
Member

Thank you@chalasr.

@fabpotfabpot merged commitfef3146 intosymfony:2.7Jan 4, 2017
fabpot added a commit that referenced this pull requestJan 4, 2017
…ndles with custom structure (chalasr)This PR was merged into the 2.7 branch.Discussion----------[FrameworkBundle][HttpKernel] Fix resources loading for bundles with custom structure| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#18563| License       | MIT| Doc PR        |  n/aThis fixes twig/translator/validator/serializer resource loading for bundles overriding `Bundle::getPath()`, adding a kernel parameter containing the bundle metadata (i.e. `path`, `namespace` and `parent`).Fixes#18563 and unlocks#19586Commits-------fef3146 Fix serializer/translations/validator resources loading for bundles overriding getPath()
@chalasrchalasr deleted the kernel/bundle_metadata branchJanuary 4, 2017 20:00
This was referencedJan 12, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot left review comments

@xabbuhxabbuhxabbuh left review comments

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

8 participants

@chalasr@ogizanagi@xabbuh@stof@fabpot@Haehnchen@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp