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

Fix: add distinct to donation forms list query to prevent duplicate results #7114

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/DonationForms/V2/Endpoints/ListDonationForms.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public function handleRequest(WP_REST_Request $request): WP_REST_Response
}

/**
* @unreleased added distinct() to the query
* @since 2.24.0 Refactor to query through the ModelQueryBuilder
*
* @return array
Expand All @@ -170,7 +171,7 @@ public function getForms(): array
$query->limit($perPage)
->offset(($page - 1) * $perPage);

$donationForms = $query->getAll();
$donationForms = $query->distinct()->getAll();

if ( ! $donationForms) {
return [];
Expand Down