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

Fix deprecations in CommandDataCollector #856

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

andrey-tech
Copy link
Contributor

Description

Fix deprecations in method collect() of class \Doctrine\Bundle\MongoDBBundle\DataCollector\CommandDataCollector.

Q A
Branch? 4.7.x
Bug fix? no
New feature? no
Deprecations? yes
Tickets Fix issue #855
License MIT
Doc PR -

Fix deprecations on PHP version 8.3 and ext-mongodb version 1.20:

Deprecated: Function MongoDB\BSON\fromPHP() is deprecated in vendor/doctrine/mongodb-odm-bundle/DataCollector/CommandDataCollector.php on line 39.

Deprecated: Function MongoDB\BSON\toCanonicalExtendedJSON() is deprecated in vendor/doctrine/mongodb-odm-bundle/DataCollector/CommandDataCollector.php on line 39.

Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

LGTM. I'll have to take a look at what phpcs is complaining about.

@@ -33,10 +32,11 @@ public function collect(Request $request, Response $response, ?Throwable $except
'commands' => array_map(
static function (Command $command): array {
$dbProperty = '$db';
$document = Document::fromPHP($command->getCommand());
Copy link
Member

Choose a reason for hiding this comment

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

@jmikola This reminds me that we should have a way to get the command document as BSON so we can safe ourselves the round trip conversion.

@alcaeus alcaeus changed the base branch from 4.7.x to 5.0.x September 30, 2024 11:48
@alcaeus alcaeus added this to the 5.0.2 milestone Sep 30, 2024
@alcaeus
Copy link
Member

alcaeus commented Sep 30, 2024

Rebased onto 5.0.x as we no longer support 4.x.

@alcaeus alcaeus merged commit fdc40f3 into doctrine:5.0.x Sep 30, 2024
4 checks passed
@alcaeus alcaeus linked an issue Sep 30, 2024 that may be closed by this pull request
@andrey-tech
Copy link
Contributor Author

alcaeus

Rebased onto 5.0.x as we no longer support 4.x.

Could you please copy changes from this my PR to branch 4.7.x? I can't migrate away from annotations (4.7.x) to attributes (5.0.x) in my big project just now. So I will be able to temporarily switch to the branch 4.7.x-dev in my project (if 4.x is no longer supported). Thank you very much.

@alcaeus
Copy link
Member

alcaeus commented Oct 2, 2024

Could you please copy changes from this my PR to branch 4.7.x? I can't migrate away from annotations (4.7.x) to attributes (5.0.x) in my big project just now. So I will be able to temporarily switch to the branch 4.7.x-dev in my project (if 4.x is no longer supported). Thank you very much.

You can maintain a separate version of 4.7.x in your own fork and use that by adding a VCS repository in composer.json. 4.x is no longer supported by us, and the deprecation notices are emitted by PHP itself based on tentative return types added to the extension. They'll let you know that the return type will change in the future, but if you're not planning to upgrade (and as a matter of fact, won't be able to with 4.x) then you can safely ignore them and send them to the digital waste bin.

@andrey-tech
Copy link
Contributor Author

You can maintain a separate version of 4.7.x in your own fork...

Ok, there is nothing else to do. Done — 4.7.1.

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.

Functions fromPHP() and toCanonicalExtendedJSON() is deprecated
2 participants