Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Data from referenced content type is separated #16

Closed
jckfa opened this issue Aug 6, 2016 · 3 comments
Closed

Data from referenced content type is separated #16

jckfa opened this issue Aug 6, 2016 · 3 comments
Assignees

Comments

@jckfa
Copy link
Contributor

jckfa commented Aug 6, 2016

Hi, I don't know if this is a mapping issue (I've never done any custom mapping before) but here's where I'm at:

I have a Article content type that references an Author content type (allowing multiple authors).
When I import the data, this is what I get:


---
article:
- sys:
    id: ...
  title: ...
  author:
  - sys:
      id: ...
  - sys:
      id: ...
  body: ...

author:
- sys:
    id: ...
  name: ...
  dob: ...
- sys:
    id: ...
  name: ...
  dob: ...

The author fields "name" and "dob" are not inside article.

I need the data to format like this:


---
article:
- sys:
    id: ...
  title: ...
  author:
  - sys:
      id: ...
    name: ...
    dob: ...
  - sys:
      id: ...
    name: ...
    dob: ...
  body: ...

That way, I can fetch the data of each author within a particular article.

@dlitvakb
Copy link
Contributor

dlitvakb commented Aug 6, 2016

Hey @jckfa,

Have you added include: N to your CDA query parameter? (N being a number from 2 to 10)

If you have done that and are still facing this issue, you're encountering a bug that will be soon fixed by this contentful/contentful.rb#99 PR, and will be merged early next week.

Hope that helps.

Cheers

@jckfa
Copy link
Contributor Author

jckfa commented Aug 6, 2016

@dlitvakb Ok, awesome, thank you! Yeah, I have include: 10 and the issue still persists.

I actually just figured out how to fetch the article-specific author data by nesting some for loops and comparing the sys ids of the content type entries.

But the bug fix would make my code a lot simpler, haha.

@dlitvakb
Copy link
Contributor

dlitvakb commented Aug 8, 2016

Hey @jckfa,

The fix has been finished, we're reviewing and making sure it will not break anymore.

Merge and deploy will be done between today, and tomorrow. Most likely tomorrow morning.

Cheers

@jckfa jckfa closed this as completed Aug 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants