From 3467bc7bb30d95a6869fc0221f95f4bf99ca62dd Mon Sep 17 00:00:00 2001 From: Jon Waldstein Date: Wed, 22 Nov 2023 12:58:25 -0500 Subject: [PATCH] fix: add distinct to query to prevent duplicate results --- src/DonationForms/V2/Endpoints/ListDonationForms.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DonationForms/V2/Endpoints/ListDonationForms.php b/src/DonationForms/V2/Endpoints/ListDonationForms.php index 98019af5f6..22b07f4d8c 100644 --- a/src/DonationForms/V2/Endpoints/ListDonationForms.php +++ b/src/DonationForms/V2/Endpoints/ListDonationForms.php @@ -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 @@ -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 [];