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

[DoctrineBridge] Add check for lazy object interface #53079

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

maxbaldanza
Copy link
Contributor

@maxbaldanza maxbaldanza commented Dec 14, 2023

In Symfony 6.4 lazy loading of ghost proxies is used out of the box.

This means if using 6.4 components with the 5.4 version of the doctrine
bridge you get the following error when trying to reset the entity manager:

Resetting a non-lazy manager service is not supported.
Declare the "doctrine.orm.default_entity_manager" service as lazy.

The entity manager is set as lazy
already in our case but it extends \Symfony\Component\VarExporter\LazyObjectInterface instead of the LazyLoadingInterface that's expected

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

In Symfony 6.4 lazy loading of ghost
proxies is the default.

This means if using 6.4 components
with the 5.4 version of the doctrine
bridge you get the following error
when trying to reset the entity manager:

```
Resetting a non-lazy manager service is not supported.
Declare the "doctrine.orm.default_entity_manager" service as lazy.
```

The entity manager is set as lazy
already in our case but it extends `\Symfony\Component\VarExporter\LazyObjectInterface`
instead of the `LazyLoadingInterface`
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

Works for me. This is special case because we made flex allow recent VarExporter to be combined with 5.4 apps to make it easier to upgrade to latest versions of Doctrine.

@maxbaldanza
Copy link
Contributor Author

Works for me. This is special case because we made flex allow recent VarExporter to be combined with 5.4 apps to make it easier to upgrade to latest versions of Doctrine.

Thanks @nicolas-grekas 🙌

@fabpot
Copy link
Member

fabpot commented Dec 19, 2023

Thank you @maxbaldanza.

@fabpot fabpot merged commit ddf3bcb into symfony:5.4 Dec 19, 2023
5 of 11 checks passed
@maxbaldanza maxbaldanza deleted the var-exporter-doctrine branch December 19, 2023 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants