Skip to content

Commit

Permalink
fix: include YouTube/Vimeo id in DocumentElementType\VideoType (#768)
Browse files Browse the repository at this point in the history
Error: The field was included, but didn't contain a value
Resolved with: Adding a resolve function and changing type to string (as a YouTube id contains non-numeric characters)
  • Loading branch information
youwe-petervanderwal committed Jul 25, 2023
1 parent 8bfe60b commit 068882e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/GraphQL/DocumentElementType/VideoType.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ public static function getInstance(Service $graphQlService, AssetType $assetType
}
],
'id' => [
'type' => Type::int()
'type' => Type::string(),
'resolve' => static function ($value = null, $args = [], $context = [], ResolveInfo $resolveInfo = null) {
if ($value instanceof Video) {
return $value->getId();
}
}
],
'type' => [
'type' => Type::string(),
Expand Down

0 comments on commit 068882e

Please sign in to comment.