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

Try to auto-detect a bundle's model namespace by default #9040

Merged
merged 1 commit into from
Dec 27, 2017
Merged

Try to auto-detect a bundle's model namespace by default #9040

merged 1 commit into from
Dec 27, 2017

Conversation

mbabker
Copy link
Contributor

@mbabker mbabker commented Dec 18, 2017

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets N/A
License MIT

The AbstractResourceBundle right now requires that bundles/plugins define a model namespace. Following conventions in core, by default this is presumably <BundleNamespace>\Model. So instead of forcing child classes to define this we can make an assumption by default as a small DX improvement.

For the most part this doesn't impact core as most bundles are using component models (except for the two changed here). But this can impact the plugin ecosystem and local app development by requiring one less method to set up.

@lchrusciel lchrusciel added the DX Issues and PRs aimed at improving Developer eXperience. label Dec 19, 2017
@lchrusciel
Copy link
Member

I'm wondering if it shouldn't go to 1.0 branch. /cc @pamil

@pamil pamil changed the base branch from master to 1.1 December 27, 2017 14:32
@pamil
Copy link
Contributor

pamil commented Dec 27, 2017

@lchrusciel I'll rather keep 1.0 branch only for bugfixes, this is a nice DX improvement so the next minor is the best choice.

@@ -97,9 +97,9 @@ protected function getDoctrineMappingDirectory(): string
*
* @return string
*/
protected function getModelNamespace(): ?string
protected function getModelNamespace(): string
Copy link
Contributor

Choose a reason for hiding this comment

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

Changing the return typehint by removing nullability is a no-go zone :) It would break 3rd party applications if they're using the currently correct method signature with ?string return typehint.

@pamil
Copy link
Contributor

pamil commented Dec 27, 2017

@mbabker thanks for this PR, making plugins development easier is vital for Sylius 🎉 Let's change that typehint and it's good to go.

@mbabker
Copy link
Contributor Author

mbabker commented Dec 27, 2017

Updated, though you should really add that change to the 2.0 backlog 😉

@pamil pamil merged commit 5315a92 into Sylius:1.1 Dec 27, 2017
@pamil
Copy link
Contributor

pamil commented Dec 27, 2017

Thank you Michael! 🥇

@mbabker mbabker deleted the detect-model-namespace branch December 27, 2017 19:09
wadjeroudi added a commit to printoclock/Sylius that referenced this pull request Jan 9, 2018
v1.0.7

- [Sylius#9075](Sylius#9075) Test sylius:install command on Travis (@pamil)
- [Sylius#9070](Sylius#9070) Extend Travis build matrix & setup extra jobs running nightly (1.1) (@pamil)
- [Sylius#9071](Sylius#9071) Update composer.json (1.0) (@pamil)
- [Sylius#9069](Sylius#9069) Extend Travis build matrix & setup extra jobs running nightly (1.0) (@pamil)
- [Sylius#9065](Sylius#9065) Various Travis changes (@pamil)
- [Sylius#9048](Sylius#9048) Exclude the web/media directory from firewall restrict list. (@Hailong)
- [Sylius#9040](Sylius#9040) Try to auto-detect a bundle's model namespace by default (@mbabker)
- [Sylius#9063](Sylius#9063) Require Symfony ^3.4 in components & bundles (@pamil)
- [Sylius#9055](Sylius#9055) Remove PHP <= 7.1 Polyfills (@stefandoorn)
- [Sylius#9052](Sylius#9052) Fixes history issue when adding to cart (@gabriel-cardoso)
- [Sylius#9061](Sylius#9061) Require Symfony ^3.4 (@pamil)
- [Sylius#9060](Sylius#9060) Remove the need for using sudo on Travis (@pamil)
- [Sylius#9059](Sylius#9059) Make Travis use the most recent Chromedriver (@pamil)
pamil added a commit to pamil/Sylius that referenced this pull request May 7, 2019
Try to auto-detect a bundle's model namespace by default
pamil added a commit to pamil/Sylius that referenced this pull request May 7, 2019
Try to auto-detect a bundle's model namespace by default
pamil added a commit to pamil/Sylius that referenced this pull request May 7, 2019
Try to auto-detect a bundle's model namespace by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Issues and PRs aimed at improving Developer eXperience.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants