@@ -315,7 +315,6 @@ public function wakeupReflection(ReflectionService $reflService): void
315315 $ reflField = array_key_exists ('declared ' , $ this ->mappings [$ fieldName ])
316316 ? new \ReflectionProperty ($ this ->mappings [$ fieldName ]['declared ' ], $ fieldName )
317317 : $ this ->reflClass ->getProperty ($ fieldName );
318- $ reflField ->setAccessible (true );
319318 $ this ->reflFields [$ fieldName ] = $ reflField ;
320319 }
321320 }
@@ -888,7 +887,7 @@ private function validateAndCompleteFieldMapping(array $mapping, ?self $inherite
888887 $ mapping ['assocNulls ' ] = $ mapping ['property ' ].'Nulls ' ;
889888 }
890889
891- if (array_key_exists ($ mapping ['fieldName ' ], $ this ->mappings )) {
890+ if ($ mapping [ ' fieldName ' ] && array_key_exists ($ mapping ['fieldName ' ], $ this ->mappings )) {
892891 if (!$ isField
893892 || empty ($ mapping ['type ' ])
894893 || empty ($ this ->mappings [$ mapping ['fieldName ' ]])
@@ -909,7 +908,6 @@ private function validateAndCompleteFieldMapping(array $mapping, ?self $inherite
909908 }
910909
911910 $ reflProp = $ this ->reflClass ->getProperty ($ mapping ['fieldName ' ]);
912- $ reflProp ->setAccessible (true );
913911 $ this ->reflFields [$ mapping ['fieldName ' ]] = $ reflProp ;
914912 $ this ->mappings [$ mapping ['fieldName ' ]] = $ mapping ;
915913
@@ -1212,7 +1210,7 @@ public function hasField($fieldName): bool
12121210 || $ this ->versionCreatedField === $ fieldName ;
12131211 }
12141212
1215- public function hasAssociation ($ fieldName ): bool
1213+ public function hasAssociation (string $ fieldName ): bool
12161214 {
12171215 return array_key_exists ($ fieldName , $ this ->mappings )
12181216 && in_array ($ this ->mappings [$ fieldName ]['type ' ], [self ::MANY_TO_ONE , self ::MANY_TO_MANY , 'referrers ' , 'mixedreferrers ' , 'children ' , 'child ' , 'parent ' ], true );
@@ -1232,14 +1230,14 @@ public function getAssociation(string $fieldName): array
12321230 return $ this ->mappings [$ fieldName ];
12331231 }
12341232
1235- public function isSingleValuedAssociation ($ fieldName ): bool
1233+ public function isSingleValuedAssociation (string $ fieldName ): bool
12361234 {
12371235 return array_key_exists ($ fieldName , $ this ->childMappings )
12381236 || $ fieldName === $ this ->parentMapping
12391237 || array_key_exists ($ fieldName , $ this ->referenceMappings ) && self ::MANY_TO_ONE === $ this ->mappings [$ fieldName ]['type ' ];
12401238 }
12411239
1242- public function isCollectionValuedAssociation ($ fieldName ): bool
1240+ public function isCollectionValuedAssociation (string $ fieldName ): bool
12431241 {
12441242 return array_key_exists ($ fieldName , $ this ->referenceMappings ) && self ::MANY_TO_MANY === $ this ->mappings [$ fieldName ]['type ' ]
12451243 || array_key_exists ($ fieldName , $ this ->referrersMappings )
@@ -1362,7 +1360,7 @@ public function isNullable(string $fieldName): bool
13621360 */
13631361 public function mapField (array $ mapping , ?self $ inherited = null ): void
13641362 {
1365- $ parentMapping = array_key_exists ('fieldName ' , $ mapping ) && array_key_exists ($ mapping ['fieldName ' ], $ this ->mappings )
1363+ $ parentMapping = array_key_exists ('fieldName ' , $ mapping ) && null !== $ mapping [ ' fieldName ' ] && array_key_exists ($ mapping ['fieldName ' ], $ this ->mappings )
13661364 ? $ this ->mappings [$ mapping ['fieldName ' ]]
13671365 : null ;
13681366
@@ -1547,7 +1545,7 @@ public function newInstance(): object
15471545
15481546 public function setIdentifierValue (object $ document , string $ id ): void
15491547 {
1550- if (array_key_exists ($ this ->identifier , $ this ->reflFields )) {
1548+ if (null !== $ this -> identifier && array_key_exists ($ this ->identifier , $ this ->reflFields )) {
15511549 $ this ->reflFields [$ this ->identifier ]->setValue ($ document , $ id );
15521550 }
15531551 }
0 commit comments