Skip to content

Commit c34723a

Browse files
authored
Merge pull request #19 from Zheness/fix_code_generation_json_blob_types
Fix code generation for fields with BLOB types
2 parents 5ed0e3a + cb5af95 commit c34723a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/GraphQLTypeGenerator.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ private function canBeCastToGraphQL(AbstractBeanPropertyDescriptor $descriptor)
252252
{
253253
if ($descriptor instanceof ScalarBeanPropertyDescriptor) {
254254
$phpType = $descriptor->getPhpType();
255-
if ($phpType === 'array') {
256-
// JSON type cannot be casted since GraphQL does not allow for untyped arrays.
255+
if ($phpType === 'array' || $phpType === 'resource') {
256+
// JSON or BLOB types cannot be casted since GraphQL does not allow for untyped arrays or BLOB.
257257
return false;
258258
}
259259
}
@@ -270,7 +270,10 @@ private function generateFieldCode(AbstractBeanPropertyDescriptor $descriptor) :
270270
$type = $this->getType($descriptor);
271271

272272
if ($type === null) {
273-
return " // Field $getterName is ignored. Cannot represent a JSON or BLOB field in GraphQL.";
273+
return <<<EOF
274+
// Field $getterName is ignored. Cannot represent a JSON or BLOB field in GraphQL.
275+
276+
EOF;
274277
}
275278

276279
$code = <<<EOF

0 commit comments

Comments
 (0)