@@ -160,7 +160,7 @@ public function hydrateAdd($element)
160
160
$ inversedAssociation ->setValue ($ element , $ this ->owner );
161
161
162
162
$ this ->em ->getUnitOfWork ()->setOriginalEntityProperty (
163
- spl_object_hash ($ element ), $ this ->backRefFieldName , $ this ->owner
163
+ spl_object_id ($ element ), $ this ->backRefFieldName , $ this ->owner
164
164
);
165
165
}
166
166
}
@@ -187,7 +187,7 @@ public function hydrateSet($key, $element)
187
187
$ inversedAssociation ->setValue ($ element , $ this ->owner );
188
188
189
189
$ this ->em ->getUnitOfWork ()->setOriginalEntityProperty (
190
- spl_object_hash ($ element ), $ this ->backRefFieldName , $ this ->owner
190
+ spl_object_id ($ element ), $ this ->backRefFieldName , $ this ->owner
191
191
);
192
192
}
193
193
}
@@ -243,8 +243,8 @@ public function getDeleteDiff()
243
243
$ collectionItems = $ this ->collection ->toArray ();
244
244
245
245
return \array_values (\array_diff_key (
246
- \array_combine (\array_map ('spl_object_hash ' , $ this ->snapshot ), $ this ->snapshot ),
247
- \array_combine (\array_map ('spl_object_hash ' , $ collectionItems ), $ collectionItems )
246
+ \array_combine (\array_map ('spl_object_id ' , $ this ->snapshot ), $ this ->snapshot ),
247
+ \array_combine (\array_map ('spl_object_id ' , $ collectionItems ), $ collectionItems )
248
248
));
249
249
}
250
250
@@ -259,8 +259,8 @@ public function getInsertDiff()
259
259
$ collectionItems = $ this ->collection ->toArray ();
260
260
261
261
return \array_values (\array_diff_key (
262
- \array_combine (\array_map ('spl_object_hash ' , $ collectionItems ), $ collectionItems ),
263
- \array_combine (\array_map ('spl_object_hash ' , $ this ->snapshot ), $ this ->snapshot )
262
+ \array_combine (\array_map ('spl_object_id ' , $ collectionItems ), $ collectionItems ),
263
+ \array_combine (\array_map ('spl_object_id ' , $ this ->snapshot ), $ this ->snapshot )
264
264
));
265
265
}
266
266
@@ -722,16 +722,16 @@ protected function doInitialize()
722
722
/**
723
723
* @param object[] $newObjects
724
724
*
725
- * Note: the only reason why this entire looping/complexity is performed via `spl_object_hash `
725
+ * Note: the only reason why this entire looping/complexity is performed via `spl_object_id `
726
726
* is because we want to prevent using `array_udiff()`, which is likely to cause very
727
727
* high overhead (complexity of O(n^2)). `array_diff_key()` performs the operation in
728
728
* core, which is faster than using a callback for comparisons
729
729
*/
730
730
private function restoreNewObjectsInDirtyCollection (array $ newObjects ) : void
731
731
{
732
732
$ loadedObjects = $ this ->collection ->toArray ();
733
- $ newObjectsByOid = \array_combine (\array_map ('spl_object_hash ' , $ newObjects ), $ newObjects );
734
- $ loadedObjectsByOid = \array_combine (\array_map ('spl_object_hash ' , $ loadedObjects ), $ loadedObjects );
733
+ $ newObjectsByOid = \array_combine (\array_map ('spl_object_id ' , $ newObjects ), $ newObjects );
734
+ $ loadedObjectsByOid = \array_combine (\array_map ('spl_object_id ' , $ loadedObjects ), $ loadedObjects );
735
735
$ newObjectsThatWereNotLoaded = \array_diff_key ($ newObjectsByOid , $ loadedObjectsByOid );
736
736
737
737
if ($ newObjectsThatWereNotLoaded ) {
0 commit comments