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

Doesn't return content, links, images and fields when serializing #324

Open
anastasiuspernat opened this issue Jun 9, 2023 · 1 comment

Comments

@anastasiuspernat
Copy link

anastasiuspernat commented Jun 9, 2023

I'm using contentful/laravel version 8.2.0 with PHP 7.4. And getting entries like this:

        $query = new Query();
        $query->setContentType('page')
        ->where('fields.slug', "test")
        ->setInclude(10); 
        $entries = $client->getEntries($query); 

The $entries do contain all the data when I var_dump them. But when I serialize them with json_encode the resulting object doesn't provide included entries and fields like content or fields (see below - content is []). There are no images and files. I have custom fields, they're not serialized either:

{
  "sys": { "type": "Array" },
  "total": 1,
  "limit": 100,
  "skip": 0,
  "items": [
    {
      ...
      "fields": {
        "title": "Test Test Test",
        "slug": "test",
        "description": "Full CMS Content Rendering Test",
        "body": {
          "nodeType": "document",
          "content": [
            {
              "nodeType": "embedded-entry-block",
              "data": {
                "target": {
                  "sys": {
                    "type": "Link",
                    "id": "XXXXXXXXXXXXXXXXXX",
                    "linkType": "Entry"
                  }
                }
              },
              "content": []  // <------ here
            },
...

Is that right? Should I serialize everything myself?
For example when using Contentful Javascript SDK, there's the whole JSON object with all levels of hierarchy in the output.

@yeisonm-legops
Copy link

I have the same problem here. The request returns the complete information but when the build is done, the includes are removed

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

No branches or pull requests

2 participants