@@ -170,7 +170,7 @@ public function onFlushEnd($em, AdapterInterface $ea)
170170 */
171171 public function processPrePersist ($ em , $ node )
172172 {
173- $ this ->pendingChildNodeInserts [spl_object_hash ($ node )] = $ node ;
173+ $ this ->pendingChildNodeInserts [spl_object_hash ($ em )][ spl_object_hash ( $ node )] = $ node ;
174174 }
175175
176176 /**
@@ -237,8 +237,9 @@ public function processPostRemove($em, $entity, AdapterInterface $ea)
237237 public function processPostPersist ($ em , $ entity , AdapterInterface $ ea )
238238 {
239239 $ uow = $ em ->getUnitOfWork ();
240+ $ emHash = spl_object_hash ($ em );
240241
241- while ($ node = array_shift ($ this ->pendingChildNodeInserts )) {
242+ while ($ node = array_shift ($ this ->pendingChildNodeInserts [ $ emHash ] )) {
242243 $ meta = $ em ->getClassMetadata (get_class ($ node ));
243244 $ config = $ this ->listener ->getConfiguration ($ em , $ meta ->name );
244245
@@ -256,7 +257,7 @@ public function processPostPersist($em, $entity, AdapterInterface $ea)
256257
257258 $ referenceMapping = $ em ->getClassMetadata ($ config ['closure ' ])->getAssociationMapping ('ancestor ' );
258259 $ referenceId = $ referenceMapping ['sourceToTargetKeyColumns ' ][$ ancestorColumnName ];
259-
260+
260261 $ entries = array (
261262 array (
262263 $ ancestorColumnName => $ nodeId ,
@@ -348,7 +349,7 @@ protected function setLevelFieldOnPendingNodes(ObjectManager $em)
348349 $ sql .= 'GROUP BY c.descendant ' ;
349350
350351 $ levelsAssoc = $ em ->getConnection ()->executeQuery ($ sql , array (array_keys ($ this ->pendingNodesLevelProcess )), array ($ type ))->fetchAll (\PDO ::FETCH_NUM );
351-
352+
352353 //create key pair array with resultset
353354 $ levels = array ();
354355 foreach ( $ levelsAssoc as $ level )
0 commit comments