@@ -376,7 +376,7 @@ public function getOrCreateDocuments(?string $className, iterable $nodes, array
376376
377377 foreach ($ class ->fieldMappings as $ fieldName ) {
378378 $ mapping = $ class ->mappings [$ fieldName ];
379- if (array_key_exists ($ mapping ['property ' ], $ properties )) {
379+ if (null !== $ mapping [ ' property ' ] && array_key_exists ($ mapping ['property ' ], $ properties )) {
380380 if (true === $ mapping ['multivalue ' ]) {
381381 if (array_key_exists ('assoc ' , $ mapping ) && null !== $ mapping ['assoc ' ]) {
382382 $ documentState [$ fieldName ] = $ this ->createAssoc ($ properties , $ mapping );
@@ -580,7 +580,8 @@ public function getOrCreateProxy(string $targetId, string $className, ?string $l
580580 }
581581
582582 $ metadata = $ this ->dm ->getClassMetadata ($ className );
583- $ proxyDocument = $ this ->dm ->getProxyFactory ()->getProxy ($ className , [$ metadata ->identifier => $ targetId ]);
583+ // TODO: what should happen when identifier is null?
584+ $ proxyDocument = $ this ->dm ->getProxyFactory ()->getProxy ($ className , [(string ) $ metadata ->identifier => $ targetId ]);
584585
585586 // register the document under its own id
586587 $ this ->registerDocument ($ proxyDocument , $ targetId );
@@ -1378,6 +1379,7 @@ public function computeChangeSet(ClassMetadata $class, object $document): void
13781379 $ destPath = $ destName = false ;
13791380
13801381 if (array_key_exists ($ oid , $ this ->originalData )
1382+ && null !== $ class ->parentMapping
13811383 && array_key_exists ($ class ->parentMapping , $ this ->originalData [$ oid ])
13821384 && array_key_exists ($ class ->parentMapping , $ changeSet )
13831385 && $ this ->originalData [$ oid ][$ class ->parentMapping ] !== $ changeSet [$ class ->parentMapping ]
@@ -1386,6 +1388,7 @@ public function computeChangeSet(ClassMetadata $class, object $document): void
13861388 }
13871389
13881390 if (array_key_exists ($ oid , $ this ->originalData )
1391+ && null !== $ class ->nodename
13891392 && array_key_exists ($ class ->nodename , $ this ->originalData [$ oid ])
13901393 && array_key_exists ($ class ->nodename , $ changeSet )
13911394 && $ this ->originalData [$ oid ][$ class ->nodename ] !== $ changeSet [$ class ->nodename ]
@@ -1397,7 +1400,7 @@ public function computeChangeSet(ClassMetadata $class, object $document): void
13971400 if ($ destPath || $ destName ) {
13981401 // add the other field if only one was changed
13991402 if (false === $ destPath ) {
1400- $ destPath = array_key_exists ($ class ->parentMapping , $ changeSet )
1403+ $ destPath = null !== $ class -> parentMapping && array_key_exists ($ class ->parentMapping , $ changeSet )
14011404 ? $ this ->getDocumentId ($ changeSet [$ class ->parentMapping ])
14021405 : PathHelper::getParentPath ($ this ->getDocumentId ($ document ));
14031406 }
@@ -1419,6 +1422,7 @@ public function computeChangeSet(ClassMetadata $class, object $document): void
14191422 }
14201423
14211424 if (array_key_exists ($ oid , $ this ->originalData )
1425+ && null !== $ class ->identifier
14221426 && array_key_exists ($ class ->identifier , $ this ->originalData [$ oid ])
14231427 && array_key_exists ($ class ->identifier , $ changeSet )
14241428 && $ this ->originalData [$ oid ][$ class ->identifier ] !== $ changeSet [$ class ->identifier ]
@@ -2926,7 +2930,7 @@ public function getDocumentById(string $id): ?object
29262930 public function getDocumentId ($ document , bool $ throw = true ): ?string
29272931 {
29282932 $ oid = is_object ($ document ) ? \spl_object_hash ($ document ) : $ document ;
2929- if (empty ($ this ->documentIds [$ oid ])) {
2933+ if (null === $ oid || empty ($ this ->documentIds [$ oid ])) {
29302934 if (!$ throw ) {
29312935 return null ;
29322936 }
@@ -3195,6 +3199,7 @@ public function doLoadTranslation(object $document, ClassMetadata $metadata, ?st
31953199 // current locale is already loaded and not removed
31963200 if (!$ refresh
31973201 && array_key_exists ($ oid , $ this ->documentTranslations )
3202+ && null !== $ currentLocale
31983203 && array_key_exists ($ currentLocale , $ this ->documentTranslations [$ oid ])
31993204 ) {
32003205 return ;
0 commit comments