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

Allow doctrine/persistence 2.x #1181

Merged
merged 2 commits into from
Aug 24, 2020
Merged

Allow doctrine/persistence 2.x #1181

merged 2 commits into from
Aug 24, 2020

Conversation

fruitwasp
Copy link
Contributor

@fruitwasp fruitwasp commented Jun 25, 2020

  • Allows doctrine/persistence 2.x
  • Updates namespace of Doctrine persistence classes in tests.

@ostrolucky
Copy link
Member

forward compatibility layer is present in 1.3, but no backwards compatibility layer is present in 2.0 AFAIK. We cannot suddenly start wiring incompatible classes, it will break projects that expect us wiring common\persistence compatible services.

@greg0ire
Copy link
Member

Maybe create service with the old FQCN as service id, but the new FQCN as class, and deprecate those in favor of services with the new FQCN as service id (and class)?

@ostrolucky
Copy link
Member

I would rather drop support for persistence 1.x

@fruitwasp
Copy link
Contributor Author

Agree on dropping support for 1.x. Apart from this, it requires support for 2.x in the symfony/doctrine-bridge too, as this bundle has a dependency on it. Will target master. symfony/symfony@master...fruitwasp:doctrine-bridge your thoughts?

@ostrolucky
Copy link
Member

That could work. Plan is that next minor doctrine-bundle release will by synced with next minor symfony release.

@greg0ire
Copy link
Member

greg0ire commented Jun 26, 2020

IMO if you don't add the || ^2.0 and require a recent enough version of persistence, you can contribute a lot of the changes in this PR to the stable branch, provided you add deprecated aliases with the old names. I would start there.

@ostrolucky ostrolucky added the Status: On Hold Most likely waiting for upstream resolution label Jun 28, 2020
@nusphere
Copy link

the actual release ob Symfony allow to install doctrine/persistence 2.x #1190 - this breaks some update processes

@stof
Copy link
Member

stof commented Jul 24, 2020

Note that the title of this PR is not describing what it does. currently, it does not only add support for 2.x, but it also removes support for 1.x

@nicolas-grekas
Copy link
Member

Keeping support for v1 would be great for the community.

@ostrolucky
Copy link
Member

Maybe I'm missing something, but I don't see how can we solve issue I mentioned for persistence 2.x and at the same time keep support for v1

@ostrolucky ostrolucky added Status: Needs Decision and removed Status: On Hold Most likely waiting for upstream resolution labels Jul 28, 2020
@ostrolucky ostrolucky changed the title Adds support for doctrine/persistence 2.x Allow doctrine/persistence 2.x Jul 28, 2020
@greg0ire
Copy link
Member

@ostrolucky what's wrong with #1181 (comment) ?

@ostrolucky
Copy link
Member

Problem with that is people who inject common\persistence\* will get incompatible persistence\* like I mentioned earlier

@greg0ire
Copy link
Member

it will break projects that expect us wiring common\persistence compatible services.

Are you thinking of projects that require doctrine/common but not (yet) doctrine/persistence? If yes, a solution would be to require doctrine/common 3 first. That would force said packages to express their dependency to doctrine/persistence, as mentioned in https://github.com/doctrine/common/releases/tag/3.0.0

@ostrolucky
Copy link
Member

doctrine/common 3.0 requires doctrine/persistence 2.0, so end result is same - unsupported doctrine/persistence 1.x

@greg0ire
Copy link
Member

Ah right indeed. @nicolas-grekas persistence 1 and 2 have very similar constraints, so I think it wouldn't actually be that big of a deal. We might want to require common 3 or at least conflict with anything below that to be on the safe side.

@stof
Copy link
Member

stof commented Jul 31, 2020

common\persistence\* class names are class aliases for the new name in doctrine 1.3+.

If your code relies on these aliases, it is indeed not compatible with doctrine/persistence 2.x. But that's solved by requiring doctrine/persistence 1.x in that package (which should be in your dependencies anyway if you rely on it).
this is not a blocker for making DoctrineBundle compatible with both 1.x and 2.x (with the right lower bound on 1.x to ensure we have access to the new names)

@greg0ire
Copy link
Member

which should be in your dependencies anyway if you rely on it

That's the thing, you could be relying on common\persistence\* and have only a version of doctrine/common older than 2.10, that would be valid (although less and less likely I suppose). Even having something newer and still only have "doctrine/common": ~2.10 is valid, having that namespace available is part of the contract of common 2.

@stof
Copy link
Member

stof commented Jul 31, 2020

@greg0ire no. Having that namespace available is part of the contract of doctrine/persistence 1.4+ as that's where they are implemented (the 1.4 version number is from my memory. Check the changelog to validate it). We could make DoctrineBundle conflict with older versions.

@greg0ire
Copy link
Member

it's 1.3 and I think you are referring to the namespace w/o Common, which I wasn't referring to with "that namespace". So to sum up, you could:

  • have package A require doctrine/common 2 and be a legit user of Common\Persistence\*
  • require A in your project
  • also require doctrinebundle

But I just noticed that doctrine/common 2 requires doctrine/persistence 1, so I would say we are in fact not at risk here 👍

@ostrolucky
Copy link
Member

So what needs to be done?

@greg0ire
Copy link
Member

Since the early versions of the BC layer are buggy, I'd use ^1.3.7 || ^2.0 as a constraint. My comment about aliases can be ignored I think, since the definitions changed in this PR are not public (right?). Also, not sure why the build fails so badly, maybe it's because of the constraint?

@ostrolucky
Copy link
Member

Then @fruitwasp sorry about that but can you please change back constraint to allow persistence ^1.3.3?

@fruitwasp
Copy link
Contributor Author

Travis coverage test failing seems to be unrelated?

@greg0ire
Copy link
Member

I'm trying to address it in #1195 , it has to do with Symfony 5.2

@greg0ire
Copy link
Member

@fruitwasp please retarget to 2.0.x as I asked in #1181 (comment), it should fix the build.

@greg0ire greg0ire changed the base branch from master to 2.0.x August 22, 2020 10:52
@greg0ire
Copy link
Member

Nevermind, I did it for you.

@greg0ire
Copy link
Member

Although this looks like it should target 2.1.x, I choose to target 2.0.x because it should fix #1197 , in which upgrade the ORM and Common results in this bundle being dowgraded to 2.0.2, which does not have an explicit dependency on Common or Persistence => 💥

@greg0ire
Copy link
Member

@fruitwasp this should no longer be a draft, right?

@fruitwasp fruitwasp marked this pull request as ready for review August 24, 2020 09:22
@greg0ire
Copy link
Member

Woops sorry, @ostrolucky pointed out to me that the correct branch for this is 2.1.x

@greg0ire greg0ire changed the base branch from 2.0.x to 2.1.x August 24, 2020 16:23
greg0ire and others added 2 commits August 24, 2020 18:24
Services are private by default since symfony/dependency-injection 4.0,
which means the deprecated call can safely be dropped.
@ostrolucky ostrolucky added this to the 2.1.1 milestone Aug 24, 2020
@greg0ire greg0ire merged commit 22add17 into doctrine:2.1.x Aug 24, 2020
@greg0ire
Copy link
Member

Thanks @fruitwasp !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants