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

Collections are added as OR instead on AND in fetching entries from term query #10004

Closed

Conversation

xavierverve
Copy link

This fixes an issue with the REST API endpoint for fetching entries connected to a term.

In the original code, the function checked the allowed, whitelisted collections and added that as a where per collection. When multiple collections where whitelisted in the api config. The query resulted in chained AND collection query like collection = ? AND collection = ? AND collection = ?. The result is not fetching any entries at all and caused the json data array to be empty.

Copy link

github-actions bot commented May 6, 2024

Thanks for submitting a PR!

In order to review and merge PRs most efficiently, we require that all PRs grant maintainer edit access before we review them. For information on how to do this, see the relevant GitHub documentation. Additionally, GitHub doesn't allow maintainer permissions from organization accounts. Please resubmit this PR from a personal GitHub account with maintainer permissions enabled.

@github-actions github-actions bot closed this May 6, 2024
$query->where('collection', $collection);
}
$query->where(function (Builder $query) {
foreach ($this->allowedCollections as $collection) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't this be a whereIn?

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.

2 participants