From a505212bd9ca6f699b65cc2296d4e73d08910ab5 Mon Sep 17 00:00:00 2001 From: Neil Farrington Date: Thu, 21 Dec 2023 10:21:22 +0000 Subject: [PATCH] Avoid unnecessary selection of organisation users This was selecting the single user in question and hydrating the organisations' `OrganizationUser` collection with just a single user. Avoiding this select will properly hydrate each organisation. --- app/Repositories/OrganizationRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Repositories/OrganizationRepository.php b/app/Repositories/OrganizationRepository.php index 1f7bfc5..4024a38 100644 --- a/app/Repositories/OrganizationRepository.php +++ b/app/Repositories/OrganizationRepository.php @@ -14,7 +14,7 @@ public function findByUser( int $page = null ) { $query = $this->createQueryBuilder('o') - ->select('o, ou') + ->select('o') ->join('o.organizationUsers', 'ou', 'WITH', "ou.user = {$user->getId()}") ->orderBy("o.$orderBy", $order) ->getQuery();