Skip to content

Conversation

@GromNaN
Copy link
Member

@GromNaN GromNaN commented Oct 29, 2025

Use native lazy objects by default when PHP >= 7.4 and doctrine/mongodb-odm >= 2.14 (doctrine/mongodb-odm#2840)
Add a new option enable_native_lazy_objects to disable this behavior.

Todo

@GromNaN GromNaN force-pushed the native-lazy branch 3 times, most recently from b2d1933 to 7d7d2e8 Compare October 29, 2025 12:06
// Requires doctrine/mongodb-odm 2.10
$container->getDefinition('doctrine_mongodb')
->setArgument(5, $config['enable_lazy_ghost_objects'] ? Proxy::class : LazyLoadingInterface::class);
->setArgument(5, $config['enable_lazy_ghost_objects'] ? LazyLoadingInterface::class : Proxy::class);
Copy link
Member

Choose a reason for hiding this comment

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

Is this a bug in the previous implementation, or why does this need changing?

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks like a bug in the previous implementation. Not covered by a test.

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.

Minor wording change, but LGTM!

Co-authored-by: Andreas Braun <git@alcaeus.org>
@GromNaN GromNaN merged commit c7158bc into doctrine:5.5.x Oct 29, 2025
15 checks passed
@GromNaN GromNaN deleted the native-lazy branch October 29, 2025 19:51
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.

3 participants