Navigation Menu

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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix image populate #2693

Merged
merged 3 commits into from Jan 28, 2019
Merged

Fix image populate #2693

merged 3 commits into from Jan 28, 2019

Conversation

lauriejim
Copy link
Contributor

My PR is a:

Main update on the:

  • Admin
  • Documentation
  • Framework
  • Plugin

Manual testing done on the following databases:

  • Not applicable
  • MongoDB
  • MySQL
  • Postgres

Description:

When you receive populated data, morph relations are omit and it's not good for media (images)
So now we auto populate morph relations. You will receive images.

@lauriejim lauriejim added pr: 馃悰 Bug fix source: core:strapi Source is core/strapi package labels Jan 25, 2019
@lauriejim lauriejim added this to 馃暟Waiting for classification in 馃Cooking via automation Jan 25, 2019
@lauriejim lauriejim moved this from 馃暟Waiting for classification to 馃惪For next release in 馃Cooking Jan 25, 2019
}

// Images are not displayed in populated data.
// We automaticaly populate morph relations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We automatically with two 'l'

@Aurelsicoko
Copy link
Member

LGTM 馃憤

@lauriejim lauriejim added this to the 3.0.0-alpha.22 milestone Jan 28, 2019
@lauriejim lauriejim merged commit 98717a1 into master Jan 28, 2019
@lauriejim lauriejim deleted the fix-image-populate branch January 28, 2019 10:57
@jonmhutch7
Copy link

Hey @lauriejim
This is pretty soon after your commit, but I updated strapi instance and also the strapi-hook-mongoose library and still am not seeing images on old or newly created relations. Will this require an entirely new database?

@lauriejim
Copy link
Contributor Author

It's because it's actually not published on npm.
You will have to wait the alpha.22 version (will come at the beginning of next week)

@jonmhutch7
Copy link

@lauriejim Unfortunately this didn't solve any existing issues with relations and images. Will this only apply to newly created contentTypes?

@lauriejim
Copy link
Contributor Author

What is the request you did ?

@josepuma
Copy link

It didn't solve my issue. I still can't get images on relations

@zzmingo
Copy link

zzmingo commented Mar 16, 2019

+1, it didn't solve. strapi version is 3.0.0-alpha.25

@outmost
Copy link

outmost commented Apr 1, 2019

I'm seeing the same issues with 3.0.0-alpha.25.2

I have a content type (Company) with a media content field (logo), the files are being uploaded correctly - but the API is not returning the association, just "null".

I've tried suggestions from #1783, but no luck. Happy to anyone else looking into this.

@Aurelsicoko
Copy link
Member

@alexandrebodin I'm almost sure the work you're doing in the GraphQL plugin and relations will fix this issue... can you confirm?

@alexandrebodin
Copy link
Member

@Aurelsicoko Need to be tested but I think so

@soonzhi
Copy link

soonzhi commented Apr 19, 2019

i am facing this too. Not working in nested relation populations.
The morph relation is only able to be populated in single level fetch.
any updates?

@hieuxinhe94
Copy link

This issue still today 2021?

@pedrosantanna
Copy link

I'm having this issue too :( any updates?

@georgiod9
Copy link

How is there no universal solution to that? It's been 3 yrs and no one posted a proper fix yet?

I'm kind of in the same situation, my project is complete yet in production, the media uploads don't persist and the response from strapi api doesn't return relational media.

?populate=* is not the solution as it only populates content media and not media from a relation.

Anyone has a fix?

@Sparkah
Copy link

Sparkah commented Apr 5, 2023

Another year and the same issue here.

@Sparkah
Copy link

Sparkah commented Apr 5, 2023

okay, here is the solution:

Install deep populate plugin
yarn add strapi-plugin-populate-deep
or
npm add strapi-plugin-populate-deep

use /Authors?populate=deep instead of /Authors?populate=*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source: core:strapi Source is core/strapi package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Models not returning images on relations