From 32d99b2b185f445bd49ac5faec504c186df654b2 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Thu, 29 Jan 2015 10:07:23 +0100 Subject: [PATCH] Subquery strategy was duplicating results in some cases after recent changes. Adding a distinct() modifier to the query solved this problem and retains the semantincs of the find operation. --- src/ORM/Association/SelectableAssociationTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ORM/Association/SelectableAssociationTrait.php b/src/ORM/Association/SelectableAssociationTrait.php index c6a3e113ce3..f32f6ed4fcd 100644 --- a/src/ORM/Association/SelectableAssociationTrait.php +++ b/src/ORM/Association/SelectableAssociationTrait.php @@ -240,7 +240,7 @@ protected function _buildSubquery($query) } $fields = $query->aliasFields($keys, $this->source()->alias()); - return $filterQuery->select($fields, true); + return $filterQuery->select($fields, true)->distinct(); } /**