[PR #546] [MERGED] The EntityManager was not injected in uninitialized proxys which are Obj... #8350

Open
opened 2026-01-22 15:59:31 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/546
Author: @stefankleff
Created: 1/10/2013
Status: Merged
Merged: 1/12/2013
Merged by: @beberlei

Base: masterHead: hotfix/injectObjectManagerInProxy


📝 Commits (3)

  • 151192a The EntityManager was not injected in uninitialized proxys which are ObjectManagerAware.
  • dc925cc fixed indentation
  • 6032e3e Added test

📊 Changes

2 files changed (+113 additions, -4 deletions)

View changed files

📝 lib/Doctrine/ORM/UnitOfWork.php (+10 -4)
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2231Test.php (+103 -0)

📄 Description

...ectManagerAware.

I ran into that problem while I had two objects in the identitymap while hydrating a collection: one was new a "real" entity and the other one was an uninitialized proxy. For "real" entities the em is injected in line 2427, for new entities it is injected in 2436->2364, but for proxies this is missing. According to the comment "inject ObjectManager into just loaded proxies." the code in line 2427 should do this, but in fact it is just used if it is a "real" entity or an already initialized proxy. Moving the injection to outside of the condition in line 2411 (if the entity is an unitialized proxy) solves this.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/546 **Author:** [@stefankleff](https://github.com/stefankleff) **Created:** 1/10/2013 **Status:** ✅ Merged **Merged:** 1/12/2013 **Merged by:** [@beberlei](https://github.com/beberlei) **Base:** `master` ← **Head:** `hotfix/injectObjectManagerInProxy` --- ### 📝 Commits (3) - [`151192a`](https://github.com/doctrine/orm/commit/151192ae3724334c033431084d4afa9190ebd4e1) The EntityManager was not injected in uninitialized proxys which are ObjectManagerAware. - [`dc925cc`](https://github.com/doctrine/orm/commit/dc925cc9c5461ca4160c685cd40a4a769bc168eb) fixed indentation - [`6032e3e`](https://github.com/doctrine/orm/commit/6032e3efd88e762d314ad8043e68eb42c50e3df6) Added test ### 📊 Changes **2 files changed** (+113 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/UnitOfWork.php` (+10 -4) ➕ `tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2231Test.php` (+103 -0) </details> ### 📄 Description ...ectManagerAware. I ran into that problem while I had two objects in the identitymap while hydrating a collection: one was new a "real" entity and the other one was an uninitialized proxy. For "real" entities the em is injected in line 2427, for new entities it is injected in 2436->2364, but for proxies this is missing. According to the comment "inject ObjectManager into just loaded proxies." the code in line 2427 should do this, but in fact it is just used if it is a "real" entity or an already initialized proxy. Moving the injection to outside of the condition in line 2411 (if the entity is an unitialized proxy) solves this. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 15:59:31 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#8350