Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field Collections working? #22

Open
njt1982 opened this issue Oct 24, 2019 · 4 comments · May be fixed by #24
Open

Field Collections working? #22

njt1982 opened this issue Oct 24, 2019 · 4 comments · May be fixed by #24

Comments

@njt1982
Copy link

njt1982 commented Oct 24, 2019

Does this mean Field Collections are not supported?

graphql_api/src/Schema.php

Lines 1636 to 1637 in c1590e8

case 'field_collection':
break;

This is not related ^ :)


The value/revision_id always seem to be null?

Bug fixes in PR #24 and #23

@njt1982 njt1982 changed the title Field Collection Field Collections working? Oct 24, 2019
@njt1982
Copy link
Author

njt1982 commented Oct 24, 2019

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
  }
}

@njt1982
Copy link
Author

njt1982 commented Oct 25, 2019

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
  }
}

@njt1982
Copy link
Author

njt1982 commented Oct 25, 2019

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

@njt1982 njt1982 linked a pull request Oct 25, 2019 that will close this issue
@njt1982
Copy link
Author

njt1982 commented Oct 25, 2019

I think this can be closed in favour of the open PRs now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant