Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Update bundle for Sylius 1.9 / Symfony 4.4+||5.2+ #251
Update bundle for Sylius 1.9 / Symfony 4.4+||5.2+ #251
Changes from 10 commits
008f60f
6c0b403
b703b22
3ca8fd7
78fed76
91232da
fe051e4
132be1a
b1341a9
b86fc6d
0e9cce6
12d0e72
b30c0fe
9caf4ac
1bb891d
b42dfa3
2c6b206
cd9dcc5
5fc1c4c
daf5f9a
4033c8c
c1f0b43
5cc5a7c
5b70d47
922ebf0
a667967
945881d
65e0c9d
8ad9c4d
f40511a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this change needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ie. why the switch to the ORM specific interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was encountering an error in both importers when trying to run any export/import commands, something of the sort
The short version is that to circumvent this, I changed these two typehints to reflect the object that was being injected 😄
The long version: I scratched my head at this for a while as
But there seemed to be shenanigans I did not understand with what is being injected.
ContainerNrPkzm2\EntityManager_9a5be93
itself seems to implement the wrong thing.Some source: https://stackoverflow.com/a/45678423/2926899
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you have a look at what
class_implements
returns?https://github.com/mvpatel/symfony/blob/master/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManagerInterface.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can do 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to typehint
Doctrine\Persistence\ObjectManager
, I don't think I've ever seen the deprecation notice before where it specifically calls out to use the ORM's interface TBH. But, I did just monkey patch an app I'm trying to finish upgrading to Sylius 1.9 with the persistence namespace change and had zero issue using the baseObjectManager
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this remains the only concern I have left over merging this PR .. I have reached out to the Symfony community for advice once more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have a test case that fails if we revert this change? if not, could we add one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“ You’re using the persistence interface to autowire the entity manager. In future versions of DoctrineBundle (next major release) you’ll have to either alias this yourself or, better yet, inject the manager registry”
https://symfony-devs.slack.com/archives/C3FQPE6LE/p1616851875129800?thread_ts=1616793098.118500&channel=C3FQPE6LE&message_ts=1616851875.129800
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the advice you guys gave and reverted the typing and tested the import command and everything worked fine. I still think there is something there: both https://github.com/doctrine/DoctrineBundle/blob/2.2.x/UPGRADE-2.0.md#service-aliases and the fact that I did encounter the error from the original comment is strange 🤔
It would be great if someone else could give the import command a try and confirm that it does indeed work just fine with the ObjectManager typing 🙏
tl;dr it works just fine with the ObjectManager typing, as @mbabker implied 👍