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

[Maintenance] Make all API Bundle services public and unify public notation #12974

Merged
merged 1 commit into from
Aug 19, 2021

Conversation

lchrusciel
Copy link
Member

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

@lchrusciel lchrusciel added Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). API APIs related issues and PRs. labels Aug 18, 2021
@lchrusciel lchrusciel requested a review from a team as a code owner August 18, 2021 09:27
@stloyd
Copy link
Contributor

stloyd commented Aug 18, 2021

Hmmmmmmm, with all the DI injection, autowiring etc. why such change? It's against best practices of Symfony IIRC.

@Arminek
Copy link
Contributor

Arminek commented Aug 18, 2021

@lchrusciel Could you give more background on why we want to have this?

@lchrusciel
Copy link
Member Author

Hey @stloyd & @Arminek.

You are right, this PR is against Symfony Best practices. However, our internal rule is to make all services public, due to Sylius Resource Controller and testing with PHPUnit for example. In all these scenarios we are fetching services directly from the container. In the resource controller, the services are fetched to perform regular logic. In the case of PHPUnit, I just had a failing test at #12968. IIRC, Behat also requires us to have public services, but I'm not 100% sure about it.

These changes should make us coherent with something, that we introduced in #9366. All our services should be public by default, unless we will write a new ADR

@GSadee
Copy link
Member

GSadee commented Aug 19, 2021

Thank you, Łukasz! 🎉

@GSadee GSadee merged commit 0f4488a into Sylius:master Aug 19, 2021
@lchrusciel lchrusciel deleted the public-api-bundle branch September 20, 2021 20:09
GSadee added a commit that referenced this pull request Oct 21, 2021
…ner by default (lchrusciel)

This PR was merged into the 1.11-dev branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | master
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | #13230 (comment)
| License         | MIT

All services in Sylius are made public by default. This approach is needed for the potential ResourceController execution, WinzouStateMachine usage, as well as for the ease of testing. 

Already explained in #12974 (comment).

<!--
 - Bug fixes must be submitted against the 1.9 or 1.10 branch (the lowest possible)
 - Features and deprecations must be submitted against the master branch
 - Make sure that the correct base branch is set

 To be sure you are not breaking any Backward Compatibilities, check the documentation:
 https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->


Commits
-------

4cb828a [CatalogPromotion] Make criteria services public in container by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs. Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants