Skip to content

Commit

Permalink
refactoring: fix multiple entity transformer validation (part2) (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
troytft committed Feb 15, 2022
1 parent 0d9dc7f commit f8f61c6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Services/Mapper/Transformer/DoctrineEntityTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ private function transformSingleItem(string $class, string $fieldName, mixed $va
private function transformMultipleItems(string $class, string $fieldName, mixed $value): array
{
$firstCollectionItem = $value[0] ?? null;
if ($firstCollectionItem === null) {
return [];
}

$columnType = RestApiBundle\Helper\DoctrineHelper::extractColumnType($class, $fieldName);

if ($columnType === PropertyInfo\Type::BUILTIN_TYPE_INT && !is_numeric($firstCollectionItem)) {
Expand Down

0 comments on commit f8f61c6

Please sign in to comment.