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

Return all resources when some already cached #268

Merged

Conversation

o0-zzuf-0o
Copy link
Contributor

The link resolver isn't fetching all resources when some are already present in the cache pool.

The cause of this is is in the LinkResolver fetchResourcesForGivenIds function:

  • The resources fetched from the pool are put into a numerically indexed array.
  • The resources fetched from the api (via fetchCollectionFromApi) are also a numerically indexed array.
  • The arrays are combined using the + operator.

The + operator returns the right-hand array appended to the left-hand array; for keys that exist in both arrays, the elements from the left-hand array will be used, and the matching elements from the right-hand array will be ignored.

More Info

Combining the arrays using array_merge appears to produce the desired behaviour.

@o0-zzuf-0o
Copy link
Contributor Author

The failing check appears to be unrelated:

  1. src/SystemProperties/ContentType.php (single_trait_insert_per_statement, space_after_semicolon, braces)

@etiennenoel
Copy link

This needs to be merged! Any plans to merge this?

@matthew-contentful matthew-contentful merged commit f82c85b into contentful:master Nov 14, 2019
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 this pull request may close these issues.

4 participants