Skip to content

Conversation

rela589n
Copy link

@rela589n rela589n commented Aug 16, 2025

The changes integrate a forward compatibility support for doctrine/persistence#433
ClassLocator, which allows clients to pass any iterable of classes they might want.

Parallel PRs for:

Note that it doesn't provide full support for persistence 4.x, but instead implements AttributeDriver, while also adjusting some signatures to achieve compatibility with 4.x.

@rela589n rela589n force-pushed the feat-persistence-4.1-class-locator-support branch from 49caecb to f1befde Compare August 16, 2025 17:51
Copy link
Member

@dbu dbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot for looking into this. i will have a look at the github actions, i guess we are using a too old docker image to run the tests.

identifier: property.notFound
count: 1
path: ../lib/Doctrine/ODM/PHPCR/Mapping/Driver/AttributeDriver.php
reportUnmatched: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need these in the baseline? can't we make sure that phpstan runs with the latest version of persistence?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that a complete upgrade to doctrine/persistence 4.0 requires many more changes. The current code is made to be forward-compatible with ColocatedMappingDriver of persistence 4.1, but the actual upgrade to this version has yet to be implemented.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I did locally is:

  1. I adjusted a "require" section:
"doctrine/data-fixtures": "^1.0 || ^2.0",
"doctrine/persistence": "^3.0 || ^4.0@dev",
  1. Ran AttributeDriverTest.

At first, the tests were failing due to incompatible method / property declarations.

Those that could be easily fixed w/o breaking the current tests on persistence 3.x, I've committed.
Those that would break the tests on persistence 3.x, I've only monkey-patched locally to verify that AttributeDriverTest works.

Therefore, current tests run on persistence 3.x.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, i see. so as is, these changes can not be used, its only preparation for persistence 4 compatibility?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes will kick in once persistence 4 comes into play

@dbu
Copy link
Member

dbu commented Aug 21, 2025

i fixed the CI setup, please rebase this branch on 2.0.x

i updated phpstan to run on php 8.4, maybe that solves the issue with the persistance false alerts?

@rela589n rela589n force-pushed the feat-persistence-4.1-class-locator-support branch 3 times, most recently from 6ea264a to 643d4df Compare August 21, 2025 08:52
These changes are the first of migration toward doctrine/persistence 4.0.
Most of the signatures that could've been made compatible have been made compatible.
There are some other, which require more in-depth knowledge of repository to adjust / rework.
These changes integrate doctrine/persistence#433
`ClassLocator` allows clients to pass any iterable of classes they might want.
@rela589n rela589n force-pushed the feat-persistence-4.1-class-locator-support branch from 643d4df to dc1b028 Compare August 21, 2025 08:54
@dbu
Copy link
Member

dbu commented Aug 21, 2025

tests seem green now. should i merge so that we have this part of the work to upgrade? for full compatibility, further work is needed.

@rela589n
Copy link
Author

rela589n commented Aug 21, 2025

I'm wondering which version this should be merged into, since the full upgrade toward 4.0 persistence would require BC breaks. Actually, these changes to the signatures themselves are BC breaks.

@dbu
Copy link
Member

dbu commented Aug 21, 2025

I'm wondering which version this should be merged into, since the full upgrade toward 4.0 persistence would require BC breaks. Actually, these changes to the signatures themselves are BC breaks.

oh indeed. i can create a 3.x branch if you want.

@rela589n
Copy link
Author

create a 3.x branch if you want

It would be more correct, yet it's all up to you

@dbu
Copy link
Member

dbu commented Aug 26, 2025

i created the 3.0.x branch. can you edit the target of this PR?

my idea for supporting older versions (of the base doctrine libs) is: as long as its only very small effort and does benefit users (e.g. keep supporting older PHP versions) we should. but if it becomes an obstacle, either a lot of effort, or ugly solutions, or not fully profiting from the new features of the base libs, we should ditch old versions.

@rela589n rela589n changed the base branch from 2.0.x to 3.0.x August 26, 2025 06:26
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.

2 participants