Support version 2.0 of the MongoDB driver#2683
Conversation
3bc60e1 to
11c9306
Compare
|
Note: static analysis will be red until we figure out how to best handle multiple driver versions in Psalm and PHPStan. |
2d78bbb to
f2ac6c4
Compare
GromNaN
left a comment
There was a problem hiding this comment.
Calls to selectDatabase and selectCollection should be replaced with getDatabase and getCollection.
78e8a97 to
7d1e4ff
Compare
7d1e4ff to
b04329c
Compare
Done, as well as requiring 1.21.0 as minimum version. |
9dfbb60 to
2bc318d
Compare
| $db = $this->createMock(Database::class); | ||
| $db->method('selectCollection')->willReturnCallback(fn (string $collection) => $this->documentCollections[$collection]); | ||
| $db->method('getCollection')->willReturnCallback(fn (string $collection) => $this->documentCollections[$collection]); | ||
| $db->method('selectGridFSBucket')->willReturnCallback(fn (array $options) => $this->documentBuckets[$options['bucketName']]); |
There was a problem hiding this comment.
Note that we did not add getGridFSBucket in 1.21. My suggestion would be to add this method in 2.0 since the deprecation of the select methods will only happen later in the 2.x lifetime. WDYT?
|
The bundle also needs to be updated: https://github.com/doctrine/DoctrineMongoDBBundle/blob/5.2.x/composer.json#L28 |
|
Currently the dev release is still being used, the official mongo library released a stable 2.0.0 release 2 weeks back. Can this be updated? https://github.com/mongodb/mongo-php-library/releases/tag/2.0.0 |
|
Thanks for the reminder @jorenvh. Are you ready to start a pull request? You will need to replace |
|
I'll make the PR as it seems to be blocking the GitHub Actions for the branch 2.11 |
Summary
The 2.0 release of the PHP driver will mainly remove deprecated functionality, which was already removed in a previous pull request. This PR adds a separate build job to test the ODM with version 2.0 of the extension and library to ensure everything continues to work. The goal is to support both versions of the extension at the same time to make upgrading easier.