From 0c552434c1085e0eb46be5508f171fb3bab36881 Mon Sep 17 00:00:00 2001 From: David Maicher Date: Sun, 25 Feb 2024 11:24:55 +0100 Subject: [PATCH] use AssociatonMapping::toArray --- src/FieldDescription/FieldDescriptionFactory.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/FieldDescription/FieldDescriptionFactory.php b/src/FieldDescription/FieldDescriptionFactory.php index f325a74eb..808ed18e0 100644 --- a/src/FieldDescription/FieldDescriptionFactory.php +++ b/src/FieldDescription/FieldDescriptionFactory.php @@ -111,23 +111,14 @@ private function mappingToArray(array|FieldMapping|AssociationMapping $mapping): return $mapping; } - $arrayMapping = (array) $mapping; - /** * @psalm-suppress UndefinedClass * @phpstan-ignore-next-line */ - if ($mapping instanceof AssociationMapping && !isset($arrayMapping['type'])) { - /* @phpstan-ignore-next-line */ - $arrayMapping['type'] = $mapping->type(); - } - - if (isset($arrayMapping['joinColumns'])) { - foreach ($arrayMapping['joinColumns'] as $key => $joinColumn) { - $arrayMapping['joinColumns'][$key] = (array) $joinColumn; - } + if ($mapping instanceof AssociationMapping) { + return $mapping->toArray(); } - return $arrayMapping; + return (array) $mapping; } }