Skip to content

Commit

Permalink
use AssociatonMapping::toArray
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher committed Feb 25, 2024
1 parent 49d1134 commit 0c55243
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/FieldDescription/FieldDescriptionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Check failure on line 119 in src/FieldDescription/FieldDescriptionFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to method toArray() on an unknown class Doctrine\ORM\Mapping\AssociationMapping.
}

return $arrayMapping;
return (array) $mapping;
}
}

0 comments on commit 0c55243

Please sign in to comment.