-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Move doctrine deps to require-dev #36785
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
Conversation
aebe6d1
to
35579f1
Compare
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.
Wait, no, this is not correct, this bridge has to require these.
What could be changed is the composer.json of the messenger component itself: it should maybe not list any symfony/*-messenger
. Instead, ppl should install each bridge they use.
To make things smooth, legacy classes in Transport
(eg https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransport.php) should throw a LogicException telling which bridge ppl should install.
CI Failures seems unrelated |
@nicolas-grekas I'm 👍 with this solution also. But is it not too "hard" for an minor update ? |
We did it before, this is trivially fixed by ppl that will be affected - and this is not covered by the BC policy :) |
After sleeping on this and some discussions with Nicolas. I think I was wrong with #36740 (comment) This is the
|
Hm, after talking with @fabpot, we settled on your approach. Can you please add some LogicException thrown when dbal is not installed? See the other bridges for inspiration, they do something similar already. |
Oh, I posted my comment without noticing yours @Nyholm I'm OK with removing dbal/etc from the doctrine-messenger bridge. We just need these extra LogicException I mentioned in my previous comment. Sorry for the confusion. |
Hi ! So just to be sure I understand:
|
Correct, for persistence also |
35579f1
to
33d65dc
Compare
Ok, I updated with the check asked. |
@tyx and some tests are now failing because of the exception |
I think we need to throw exception when the class is used. Currently we throw them when the class is loaded. |
src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineTransport.php
Outdated
Show resolved
Hide resolved
If we remove the requirements in the bridge and we ask projects to require |
The bridges were a part of symfony/messenger in 5.0. We did not have any checks if doctrine was installed. When the bridges was moved to a separate package we (mistakenly) added doctrine dependencies. That lead to us forcing the user to install doctrine when they wanted symfony/messegner. @stof, We want to have the same behaviour as SF 5.0 and a smooth upgrade path. |
@Nyholm this won't be a smooth upgrade path to 5.0, as you will never tell users to add a requirement on the new bridge (which is what they need to do to upgrade to them in a future-proof way) |
Are you sure? There are already deprecation notices telling you to require the new package.
//Tobias Nyholm
Skickat på språng
… On 14 May 2020, at 16:55, Christophe Coevoet ***@***.***> wrote:
@Nyholm this won't be a smooth upgrade path to 5.0, as you will never tell users to add a requirement on the new bridge (which is what they need to do to upgrade to them in a future-proof way)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
To avoid requiring all doctrine stuff when require symfony/messenger (that require symfony/doctrine-messenger to ensure BC)
33d65dc
to
b73b26e
Compare
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.
Actually, because dbal and persistence are only used in constructors, they will never need to be in "require", even in 6.0. The reason is that you cannot instantiate the bridge if you don't have them already.
The good thing is that the wiring happens in doctrine-bundle, where dbal+persistence are already required.
This means this is perfect as is.
src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineTransport.php
Outdated
Show resolved
Hide resolved
@stof that's true. There is no better way IMHO. Either we ask ppl to require the bridge now, or we postpone this for 6.0. In 6.0 is the smoothest to me. Ppl will quickly figure our anyway. |
@nicolas-grekas The third solution is to keep the deprecated class independent of the new class. So they will need to require the new packages when migrating to the new classes (as that would be the way to get the new classes).
They can totally use the new classes without doing that, relying on the transitive dependency of |
Hmm. Duplicating the code, right? I think we're good enough with the current approach, let's take the simple path for us once :) |
Thank you @tyx. |
…alling symfony/messenger (ogizanagi) This PR was merged into the 5.2-dev branch. Discussion ---------- [Messenger] Don't require doctrine/persistence when installing symfony/messenger | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #36790 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | N/A As of today, [installing `symfony/messenger` installs `symfony/doctrine-messenger`](https://github.com/symfony/symfony/blob/3867fb2489ef0d07dec4859cf461bb7bcc7618e0/src/Symfony/Component/Messenger/composer.json#L23) as well. Which means adding `doctrine/persistence` as a hard dep of the latest will install it for any user requiring `symfony/messenger` in 5.2. I think it should stay a soft-dependency until we remove `symfony/doctrine-messenger` as a `symfony/messenger` dependency as of Symfony 6.0 (as mentioned in #35422). --- related: #36785 Commits ------- 5c05455 [Messenger] Don't require doctrine/persistence when installing symfony/messenger
To avoid requiring all doctrine stuff when require symfony/messenger
(that require symfony/doctrine-messenger to ensure BC)