Open njt1982 opened 5 years ago
I've just tried running this (actual collection name "redacted" to blah
):
query {
field_collection_item_field_blah(item_id: "4") {
item_id
}
}
and I get this:
{
"errors": [
{
"debugMessage": "Argument 2 passed to field_collection_item_access() must be an instance of FieldCollectionItemEntity or null, instance of EntityDrupalWrapper given, called in /var/www/example/sites/all/modules/contrib/entity/entity.module on line 661",
"message": "Internal server error",
"category": "internal",
"locations": [
{
"line": 4,
"column": 3
}
],
"path": [
"field_collection_item_field_blah"
]
}
],
"data": {
"field_collection_item_field_blah": null
},
"debug": {
"schemaBuildTime": 0.017588138580322266,
"queryTime": 0.020380020141601562,
"totalTime": 0.03798794746398926,
"Drupal\\graphql_api\\Schema::addFieldDefs": 0.0019948482513427734,
"addEntityGqlDefinition": 0.0001990795135498047,
"buildInterfaceTypes": 0.003615140914916992,
"buildObjectTypes": 0.0002658367156982422,
"drupalAlter": 0.0002930164337158203,
"GraphQLSchema": 0.0044689178466796875,
"getMutation": 0.004148006439208984
}
}
I've opened a PR for that access bug (#23 ) and I think the null value problem is larger than Field Collections as I'm getting it on a text field too. I think #15 is relevant here too?
(I know node 6 has data on this field; I can see it in the database ;) )
query {
node(nid:"6") {
nid
title
field_teaser_text {
value
format
}
}
}
Returns:
{
"data": {
"node": [
{
"nid": "6",
"title": "EXAMPLE TITLE",
"field_teaser_text": {
"value": null,
"format": null
}
}
]
},
"debug": {
"schemaBuildTime": 0.015606164932250977,
"queryTime": 0.05906796455383301,
"totalTime": 0.07468700408935547,
"Drupal\\graphql_api\\Schema::addFieldDefs": 0.002022981643676758,
"addEntityGqlDefinition": 0.0002880096435546875,
"buildInterfaceTypes": 0.0030100345611572266,
"buildObjectTypes": 0.0001671314239501953,
"drupalAlter": 0.00018596649169921875,
"GraphQLSchema": 0.004231929779052734,
"getMutation": 0.002835988998413086
}
}
Ok so the issue appears to be in here: https://github.com/olragon/graphql_api/blob/c1590e8/src/Schema.php#L1541-L1544
If I change/hack that to:
return ['value' => $items];
Then my field_teaser_text has a value...
Not entirely sure how you get the raw field values (value and format, for example) from Entity Wrapper...
EDIT: See PR #24
I think this can be closed in favour of the open PRs now?
~Does this mean Field Collections are not supported?~
https://github.com/olragon/graphql_api/blob/c1590e894babeae9670bf99725f9c7f8f8f197fb/src/Schema.php#L1636-L1637
This is not related ^ :)
The value/revision_id always seem to be null?
Bug fixes in PR #24 and #23