-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Remove direct dependencies on doctrine/common #27609
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
Remove direct dependencies on doctrine/common #27609
Conversation
4575736
to
54130d4
Compare
|
I am not sure I understand what you mean. There are no back references to
Ad changes in this PR, in Bridge/Doctrine:
Root composer.json was just updated accordingly since I assumed it works as aggregate of all dependencies. |
We can drop them from |
"doctrine/cache": "~1.6", | ||
"doctrine/collections": "~1.0", | ||
"doctrine/event-manager": "~1.0", | ||
"doctrine/persistence": "~1.0" |
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 think the only direct dependency of the doctrine bridge in doctrine/common is actually doctrine/persistence
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.
and this means the root composer.json would depend on persistence, cache and annotations.
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 think the only direct dependency of the doctrine bridge in
doctrine/common
is actuallydoctrine/persistence
I don't think this is correct, see my comment above. There are hard dependencies (inheritance, API) to other components as well.
@@ -179,4 +179,13 @@ protected function getMetadata($class) | |||
} | |||
} | |||
} | |||
|
|||
private static function getRealClass(string $class): string |
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.
What about having a class in doctrine/persistence
providing this, instead of making each package duplicate the doctrine naming convention (which would mean that changing it would be a BC break btw) ?
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 thought about that, I think we can possibly do that (probably immediately as @deprecated
already since Proxy should be gone in ORM 3.0 / Persistence 2.0) and ship it as 1.1.
DoctrinetestHelper is a testing utility depending on the ORM anyway (I don't even know why we expose it btw, as it seems specific to the bridge tests). The ORM itself is a require-dev only, so these should as well.
there is no hard dependency here. The listener says "if it is an instance of a collection, then I can clear it in a faster way". An
that one is true. I forgot we have this class in the bridge. |
I was more worried about Doctrine\Form\DataTransformer\CollectionToArrayTransformer::reverseTransform() which contains |
hmm, if you manage to use a EntityType (which is used for the ODM and ORM) without having collections installed, it might still trigger this code. But I think you would have a broken code earlier in the usage anyway (and so no reach it) |
"symfony/polyfill-ctype": "~1.8", | ||
"symfony/polyfill-mbstring": "~1.0" |
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 move the doctrine/* packages before the symfony one, to have alpha order please?
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.
If you agree, I will send separate PR with this and enabling sort-packages
config option - the order is inconsistent also for many non-doctrine packages so I'd prefer not to mix it here.
Edit: Well, actually since I added these, I moved them up. But left the other occurences where some doctrine
packages already existed.
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.
sort-package doesn't work here, because we manually merge composer.json files, so no need, as that would only make mergers' job a bit harder/slower
I had missed that, thank you. |
When a feature is optional, our policy is to not list its dependencies as mandatory requirements. |
Just checked: we should move |
54130d4
to
b0fa398
Compare
Moved "doctrine/collections": "~1.0",
"doctrine/event-manager": "~1.0",
"doctrine/persistence": "~1.0", Which is IMO correct. Of course you can also make some of them optional later. :) |
😢 |
Thank you @Majkl578. |
This PR was merged into the 4.2-dev branch. Discussion ---------- Remove direct dependencies on doctrine/common | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT | Doc PR | ? Doctrine has recently separated multiple components from doctrine/common: * [doctrine/event-manager](https://github.com/doctrine/event-manager) [[release notes](https://github.com/doctrine/event-manager/releases/tag/v1.0.0) | [split PR](doctrine/common#842)] * [doctrine/persistence](https://github.com/doctrine/persistence) [[release notes](https://github.com/doctrine/persistence/releases/tag/v1.0.0) | [split PR](doctrine/common#845)] * [doctrine/reflection](https://github.com/doctrine/reflection) [[release notes](https://github.com/doctrine/reflection/releases/tag/v1.0.0) | [split PR](doctrine/common#845)] All of the packages are 100% backward compatible with their counterparts in Common 2.8. This is a major step to slowly start with [phasing out doctrine/common package](doctrine/common#826) before ORM 3.0 / DBAL 3.0 / ODM 3.0. Common 2.9.0 will also be composed from these new packages. Most of the remaining parts in doctrine/common are likely to be deprecated (or already are), please see & discuss in [the PR over in doctrine/common repository](doctrine/common#845). This PR therefore aims to remove the direct doctrine/common dependency from Symfony, replacing it by specific Doctrine components. Commits ------- b0fa398 Remove direct dependencies on doctrine/common
Reverted in 5fe78a3: by adding runtime deprecation, doctrine/common#845 highlighted that this was merged too early: doctrine/orm is not up to date and still triggers deprecated code paths. Please resubmit once this is fixed. (Resubmitting now would make tests fail, we now have visibility on the issue so it won't happen again.) |
doctrine/common#845 has absolutely no impact on this change. You will face the same issue with or without this PR. |
Reverting allows locking to a stable version of doctrine/common, which is deprecation-free for now. That's the only way to make our test suite green. Of course, please don't tag a stable version of |
Why is your test suite failing when 3rd-party code triggers deprecated code? That shouldn't be an issue for Symfony as ORM is 3rd-party. Shouldn't you use weak-vendors? |
Because this way we help ensure the dependencies we rely on are at least as stable as we'd like to provide to our users. Personally, I believe this is one of the best part of OSS: e.g., in this case, we help Doctrine spot issues earlier, for the benefit of everyone. |
There is no stable combination of Symfony + ORM + Common that would allow installation of Common 2.9 (which isn't even released). What you are talking about is currently only a development version. Also you are testing a Symfony 4.2-dev (where this PR was merged into) which is scheduled to be released in november (5 months from now).
Based on the above, I don't think this statement is correct. This is only applicable to 4.2-dev with
By testing a development versions in your development version (with no stable minor release)... That doesn't sound correct to me. |
What I care about is having Travis green so that we can merge PRs safely. This is the minimal change I had to do to achieve that. |
(Please submit again on master) |
ORM 2.6-dev: doctrine/orm@6d81d51 |
Hello ! We just got that deprecation notice when running our test suite. Since it's not related to our codebase nor Symfony directly (and this PR seems to be shipped in 5 months), is there a better way than disabling deprecation notice during tests to handle that error ? |
Are you running with latest dependencies? ORM should already be quite
deprecation-free.
…On Mon, 16 Jul 2018, 09:53 Stéphane HULARD, ***@***.***> wrote:
Hello !
We just got that deprecation notice when running our test suite.
Since it's not related to our codebase nor Symfony directly (and this PR
seems to be shipped in 5 months), is there a better way than disabling
deprecation notice during tests to handle that error ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#27609 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJakPhK3fBwliY0uorvmY7fPF8awJECks5uHEZ2gaJpZM4Uo4O1>
.
|
Yes, we use the latest dependencies. We check using CI with We are using
Maybe it's related to our current environment / setup ? |
Yep, so if I read this correctly, you already have everything. Try adding a |
This is not related to this PR, it was reverted I and I am not re-submitting it again. We missed one case which triggers a silent-only deprecation, see doctrine/orm#7306 (comment). Your test suite should ignore this type of deprecation call, please see the referenced PR to see how to configure your test suite properly. Also note that ORM will require Common until ORM 3.0, it can't be removed sooner due to BC. |
Hello ! Thanks a lot for the details. Yes trying to kick out Common doesn't work actually and it's not a problem. If I use the symfony It's fixed for me 😄. |
This PR was merged into the 4.2-dev branch. Discussion ---------- Remove direct dependencies on doctrine/common | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Resubmitting #27609 now that Doctrine should be deprecation free. Commits ------- cb91cde Remove direct dependencies on doctrine/common
Could you elaborate on this one, please, for searching Symfony docs using Google/DDG (searching for "symfony weak_vendors") is a mess delivering lots of pages not even matching the keyword "weak" except for one on PHPUnit/Bridge mentioning this configuration option in a similarly brief way you did here. I sometimes wonder if Symfony community is really struggling with proper documentation this much ... even this approach is talking about what this value is for rather than telling where to put it. One of the first impediments in understanding Symfony is due to limited documentation on paradigms for configuration hierarchy. Placing |
@soletan there's no such thing as "the Symfony community" here: that's just code and doc laying out for you to use and improve. As I read it, the doc already tells how to configure the bridge here: |
Hello, When some dependencies or classes are deprecated why are not removed and still available and used. I installed Symfony4.1 with Doctrine and when I runt the Tests all the asserts passed successfully but at the end I got error (because of existence of such deprecated class). What should I do and how can avoid that? or should I wait till the upgraded version of Doctrine (v3)? |
@engharb Looks like you've missed the clear instruction just as I did. You need to set environment variable
when starting your unit tests. This will suppress those warning or at least prevent them from failing your test run. |
@soletan Thank you very much. Now it works. |
Any news on what version this will be released with? |
Hello @crmpicco, this is not a Symfony problem so that kind of issues will not enter the symfony release lifecycle. If you prefer not using the weak vendor mode, you can allow a specific number of deprecations with the constant :
This statement will allow 1 deprecation only. |
In the end, in this case: Doctrine\Common\ClassLoader is deprecated (https://pasteboard.co/HJOKbzk.png), we have 2 ways
|
Doctrine has recently separated multiple components from doctrine/common:
All of the packages are 100% backward compatible with their counterparts in Common 2.8.
This is a major step to slowly start with phasing out doctrine/common package before ORM 3.0 / DBAL 3.0 / ODM 3.0.
Common 2.9.0 will also be composed from these new packages.
Most of the remaining parts in doctrine/common are likely to be deprecated (or already are), please see & discuss in the PR over in doctrine/common repository.
This PR therefore aims to remove the direct doctrine/common dependency from Symfony, replacing it by specific Doctrine components.