Skip to content

Use event's ObjectManager instead of injected EntityManager in DoctrineEncryptListener#68

Merged
mogilvie merged 3 commits intomogilvie:masterfrom
jdecool:listener-use-event-object-manager
Feb 19, 2026
Merged

Use event's ObjectManager instead of injected EntityManager in DoctrineEncryptListener#68
mogilvie merged 3 commits intomogilvie:masterfrom
jdecool:listener-use-event-object-manager

Conversation

@jdecool
Copy link
Copy Markdown
Contributor

@jdecool jdecool commented Jan 29, 2026

The DoctrineEncryptListener is currently using the default injected EntityManager. This caused errors when working with entities coming from another EntityManager of the default one (for example, we use this bundle in a modular monolith application, where each module is managed by its own EntityManager).

This PR refactors the DoctrineEncryptListener to use the ObjectManager from the event arguments instead of the injected EntityManager instance. So it will use the EntityManager related to the processing entity.

@jdecool
Copy link
Copy Markdown
Contributor Author

jdecool commented Feb 10, 2026

Hey @mogilvie, do you have some time to look at this PR ?

Move deprecation from constructor to doc block for compatibility with other php and symfony versions.
@mogilvie mogilvie self-assigned this Feb 19, 2026
@mogilvie mogilvie merged commit 14b8dfe into mogilvie:master Feb 19, 2026
7 checks passed
@mogilvie
Copy link
Copy Markdown
Owner

Thanks for your contribution @jdecool
I only made a slight change to the deprecation note for compatibility with other versions.

@jdecool jdecool deleted the listener-use-event-object-manager branch February 19, 2026 12:30
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.

2 participants