Feature: add support for ClassLocator from doctrine/persistence 4.1#875
Conversation
49caecb to
f1befde
Compare
dbu
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
why do we need these in the baseline? can't we make sure that phpstan runs with the latest version of persistence?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
What I did locally is:
- I adjusted a "require" section:
"doctrine/data-fixtures": "^1.0 || ^2.0",
"doctrine/persistence": "^3.0 || ^4.0@dev",- 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.
There was a problem hiding this comment.
ah, i see. so as is, these changes can not be used, its only preparation for persistence 4 compatibility?
There was a problem hiding this comment.
These changes will kick in once persistence 4 comes into play
|
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? |
6ea264a to
643d4df
Compare
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.
643d4df to
dc1b028
Compare
|
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. |
|
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. |
It would be more correct, yet it's all up to you |
|
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. |
In the scope of doctrine/persistence#433 (available from `doctrine/persistence` >= 4.1) there was added `ColocatedMappingDriver::$classLocator`, which allows passing any instance of `ClassLocator` for the mapping driver to use. This commit integrates those changes into `AbstractDoctrineExtension`, used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution registers a "mapping_class_finder" service that can be used by the client code to customize class finding logic. The changes come into play starting with doctrine/persistence >= 4.1, and the actual registration happens only if `AttributeDriver` supports `ClassLocator`. Dependent libraries would adhere to the same interface, where `ClassLocator` is in the first argument. The changes were introduced for: - ORM: doctrine/orm#12131; - ODM: doctrine/mongodb-odm#2802; - PHPCR ODM: doctrine/phpcr-odm#875.
In the scope of doctrine/persistence#433 (available from `doctrine/persistence` >= 4.1) there was added `ColocatedMappingDriver::$classLocator`, which allows passing any instance of `ClassLocator` for the mapping driver to use. This commit integrates those changes into `AbstractDoctrineExtension`, used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution registers a "mapping_class_finder" service that can be used by the client code to customize class finding logic. The changes come into play starting with doctrine/persistence >= 4.1, and the actual registration happens only if `AttributeDriver` supports `ClassLocator`. Dependent libraries would adhere to the same interface, where `ClassLocator` is in the first argument. The changes were introduced for: - ORM: doctrine/orm#12131; - ODM: doctrine/mongodb-odm#2802; - PHPCR ODM: doctrine/phpcr-odm#875.
In the scope of doctrine/persistence#433 (available from `doctrine/persistence` >= 4.1) there was added `ColocatedMappingDriver::$classLocator`, which allows passing any instance of `ClassLocator` for the mapping driver to use. This commit integrates those changes into `AbstractDoctrineExtension`, used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution registers a "mapping_class_finder" service that can be used by the client code to customize class finding logic. The changes come into play starting with doctrine/persistence >= 4.1, and the actual registration happens only if `AttributeDriver` supports `ClassLocator`. Dependent libraries would adhere to the same interface, where `ClassLocator` is in the first argument. The changes were introduced for: - ORM: doctrine/orm#12131; - ODM: doctrine/mongodb-odm#2802; - PHPCR ODM: doctrine/phpcr-odm#875.
In the scope of doctrine/persistence#433 (available from `doctrine/persistence` >= 4.1) there was added `ColocatedMappingDriver::$classLocator`, which allows passing any instance of `ClassLocator` for the mapping driver to use. This commit integrates those changes into `AbstractDoctrineExtension`, used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution registers a "mapping_class_finder" service that can be used by the client code to customize class finding logic. The changes come into play starting with doctrine/persistence >= 4.1, and the actual registration happens only if `AttributeDriver` supports `ClassLocator`. Dependent libraries would adhere to the same interface, where `ClassLocator` is in the first argument. The changes were introduced for: - ORM: doctrine/orm#12131; - ODM: doctrine/mongodb-odm#2802; - PHPCR ODM: doctrine/phpcr-odm#875.
In the scope of doctrine/persistence#433 (available from `doctrine/persistence` >= 4.1) there was added `ColocatedMappingDriver::$classLocator`, which allows passing any instance of `ClassLocator` for the mapping driver to use. This commit integrates those changes into `AbstractDoctrineExtension`, used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution registers a "mapping_class_finder" service that can be used by the client code to customize class finding logic. The changes come into play starting with doctrine/persistence >= 4.1, and the actual registration happens only if `AttributeDriver` supports `ClassLocator`. Dependent libraries would adhere to the same interface, where `ClassLocator` is in the first argument. The changes were introduced for: - ORM: doctrine/orm#12131; - ODM: doctrine/mongodb-odm#2802; - PHPCR ODM: doctrine/phpcr-odm#875.
In the scope of doctrine/persistence#433 (available from `doctrine/persistence` >= 4.1) there was added `ColocatedMappingDriver::$classLocator`, which allows passing any instance of `ClassLocator` for the mapping driver to use. This commit integrates those changes into `AbstractDoctrineExtension`, used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution registers a "mapping_class_finder" service that can be used by the client code to customize class finding logic. The changes come into play starting with doctrine/persistence >= 4.1, and the actual registration happens only if `AttributeDriver` supports `ClassLocator`. Dependent libraries would adhere to the same interface, where `ClassLocator` is in the first argument. The changes were introduced for: - ORM: doctrine/orm#12131; - ODM: doctrine/mongodb-odm#2802; - PHPCR ODM: doctrine/phpcr-odm#875.
In the scope of doctrine/persistence#433 (available from `doctrine/persistence` >= 4.1) there was added `ColocatedMappingDriver::$classLocator`, which allows passing any instance of `ClassLocator` for the mapping driver to use. This commit integrates those changes into `AbstractDoctrineExtension`, used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution registers a "mapping_class_finder" service that can be used by the client code to customize class finding logic. The changes come into play starting with doctrine/persistence >= 4.1, and the actual registration happens only if `AttributeDriver` supports `ClassLocator`. Dependent libraries would adhere to the same interface, where `ClassLocator` is in the first argument. The changes were introduced for: - ORM: doctrine/orm#12131; - ODM: doctrine/mongodb-odm#2802; - PHPCR ODM: doctrine/phpcr-odm#875.
In the scope of doctrine/persistence#433 (available from `doctrine/persistence` >= 4.1) there was added `ColocatedMappingDriver::$classLocator`, which allows passing any instance of `ClassLocator` for the mapping driver to use. This commit integrates those changes into `AbstractDoctrineExtension`, used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution registers a "mapping_class_finder" service that can be used by the client code to customize class finding logic. The changes come into play starting with doctrine/persistence >= 4.1, and the actual registration happens only if `AttributeDriver` supports `ClassLocator`. Dependent libraries would adhere to the same interface, where `ClassLocator` is in the first argument. The changes were introduced for: - ORM: doctrine/orm#12131; - ODM: doctrine/mongodb-odm#2802; - PHPCR ODM: doctrine/phpcr-odm#875.
|
hi @rela589n are you still on this? should i merge the current state or do you want to do more things in this branch? |
|
Hi, @dbu , I think you can merge it, since full support for 4 would imply much work which I'm not willing to dedicate to. Current changes provide the first steps to it. |
dbu
left a comment
There was a problem hiding this comment.
thanks a lot for the contribution
|
i created https://github.com/doctrine/phpcr-odm/milestone/6 and a new issue there so we don't forget to do that before we release phpcr-odm 3. |
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:
ClassLocatorfrom Doctrine Persistence 4.1 in the attribute and annotation drivers mongodb-odm#2802ClassLocatororm#12131Note 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.