orm icon indicating copy to clipboard operation
orm copied to clipboard

Add a failing test for #10514

Open mpdude opened this issue 2 years ago • 5 comments

Here is a failing test for #10514. The commit that causes breakage is e5e674c68630c38d7da5241ffc316c5fb18edfec, the parent commit still works.

mpdude avatar Feb 13 '23 21:02 mpdude

The fix might be something like this, but if I apply it the test fails with a schema error. Can you have a look?

--- a/lib/Doctrine/ORM/UnitOfWork.php
+++ b/lib/Doctrine/ORM/UnitOfWork.php
@@ -3157,7 +3157,11 @@ class UnitOfWork implements PropertyChangedListener
      */
     public function tryGetById($id, $rootClassName)
     {
-        $idHash = implode(' ', (array) $id);
+        $class  = $this->em->getClassMetadata($rootClassName);
+        $idHash = implode(' ', $class->containsForeignIdentifier || $class->containsEnumIdentifier
+            ? $this->identifierFlattener->flattenIdentifier($class, (array) $id)
+            : (array) $id
+        );
 
         return $this->identityMap[$rootClassName][$idHash] ?? false;
     }

nicolas-grekas avatar Feb 16 '23 15:02 nicolas-grekas

Will do but can happen next wednesday in the best case

mpdude avatar Feb 16 '23 15:02 mpdude

Friendly ping @mpdude

nicolas-grekas avatar Jul 07 '23 11:07 nicolas-grekas

Ouch, lost sight of this, sorry. I'm about to leave for summer vacation and not sure how much I can help in the next three to four weeks.

I have the (yet to be proven) impression that there are several places dealing with "id hash" computation, and that a few of them were touched in the last months when either backed enums and/or objects-as-id-values came into play.

Maybe it might be worthfile to go out looking for usages/patterns and see if we can consolidate this.

The place Nicolas is referring to also looks to be related to it, and the patch suggested does not apply since the changes from #10508.

mpdude avatar Jul 07 '23 12:07 mpdude

Another friendly ping @mpdude (We are unable to migrate to later versions of Doctrine because of this bug. It is a major breaking issue for our whole application).

Wilt avatar Jun 05 '24 08:06 Wilt

There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. If you want to continue working on it, please leave a comment.

github-actions[bot] avatar Oct 29 '24 03:10 github-actions[bot]

This pull request was closed due to inactivity.

github-actions[bot] avatar Nov 06 '24 03:11 github-actions[bot]