Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HttpKernel] Parse bundle name+namespace at once #20117

Merged
merged 1 commit into from Oct 2, 2016
Merged

[HttpKernel] Parse bundle name+namespace at once #20117

merged 1 commit into from Oct 2, 2016

Conversation

ro0NL
Copy link
Contributor

@ro0NL ro0NL commented Oct 1, 2016

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets comma-separated list of tickets fixed by the PR, if any
License MIT
Doc PR reference to the documentation PR, if any

@ro0NL ro0NL changed the base branch from master to 2.7 October 1, 2016 16:19
@lemoinem
Copy link
Contributor

lemoinem commented Oct 1, 2016

Hey,

Since this is not a bug fix. Shouldn't this be applied against master? Or is the performance boost that big?

@fabpot
Copy link
Member

fabpot commented Oct 2, 2016

That's definitely for master


private function parseClassName()
{
$class = get_class($this);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is intended to target master, I'm guessing you could replace that by static::class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@ro0NL
Copy link
Contributor Author

ro0NL commented Oct 2, 2016

Or is the performance boost that big?

Not sure.. it must gain something i guess :) I thought it was nice little tweak for 2.7 as well.

Ie. imo its not a bug fix nor a new feature (new feature for the user that is). I guess the thing is we should be safe with refactoring.. as things can easily go wrong 😅

Ill target master 👍

@ro0NL ro0NL changed the base branch from 2.7 to master October 2, 2016 08:42
@fabpot
Copy link
Member

fabpot commented Oct 2, 2016

Thank you @ro0NL.

@fabpot fabpot merged commit 81b2922 into symfony:master Oct 2, 2016
fabpot added a commit that referenced this pull request Oct 2, 2016
This PR was merged into the 3.2-dev branch.

Discussion
----------

[HttpKernel] Parse bundle name+namespace at once

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any
| License       | MIT
| Doc PR        | reference to the documentation PR, if any

Commits
-------

81b2922 parse bundle name+namespace at once
@ro0NL ro0NL deleted the patch-1 branch October 2, 2016 16:00
fabpot added a commit that referenced this pull request Dec 17, 2016
This PR was merged into the 3.3-dev branch.

Discussion
----------

[HttpKernel] Fix Bundle name regression

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20117
| License       | MIT
| Doc PR        | N/A

The bundle name can be set manually instead of being guessed from the class name, as the property is protected.
However, a regression prevents this name to be used, as calling `Bundle::getNamespace()` recomputes the bundle name from class instead.

The ability to name explicitly bundles is appreciable when dealing with "virtual" ones, or when providing bundles in a library under a `Vendor\MyPackage\Bridge\Symfony\Bundle` namespace. No need to rename the bundle class `VendorMyPackageBundle` which will make the instantiation in `Kernel::registerBundle()` quite ugly:

```diff
- new Vendor\MyPackage\Bridge\Symfony\Bundle\VendorMyPackageBundle()
+ new Vendor\MyPackage\Bridge\Symfony\Bundle\Bundle()
```

What about removing `Bundle::parseClassName()` and processing the namespace and bundle name separately, but keeping the `namespace` property introduced in #20117?

Commits
-------

3b5127d [HttpKernel] Fix Bundle name regression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants