Skip to content

Commit

Permalink
Fix data type for NelmioApiDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
teohhanhui committed Apr 8, 2016
1 parent bdae24c commit 9ce2657
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Bridge/NelmioApiDoc/Parser/ApiPlatformParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ private function parseProperty(ResourceMetadata $resourceMetadata, PropertyMetad
}

$data['subType'] = $subProperty['subType'];
$data['children'] = $subProperty['children'];
if (isset($subProperty['children'])) {
$data['children'] = $subProperty['children'];
}
}

return $data;
Expand All @@ -186,9 +188,18 @@ private function parseProperty(ResourceMetadata $resourceMetadata, PropertyMetad
return $data;
}

try {
$this->resourceMetadataFactory->create($className);
} catch (ResourceClassNotFoundException $e) {
$data['actualType'] = DataTypes::MODEL;
$data['subType'] = $className;

return $data;
}

if (
(self::OUT_PREFIX === $io && $propertyMetadata->isReadableLink()) ||
(self::IN_PREFIX === $io && $propertyMetadata->isWritableLink())
(self::OUT_PREFIX === $io && !$propertyMetadata->isReadableLink()) ||
(self::IN_PREFIX === $io && !$propertyMetadata->isWritableLink())
) {
$data['dataType'] = self::TYPE_IRI;
$data['actualType'] = DataTypes::STRING;
Expand Down

0 comments on commit 9ce2657

Please sign in to comment.