From 5795fa99a3e7f3dd4a2ebd6d9b90be0efae9e49a Mon Sep 17 00:00:00 2001 From: Hafsa-Naeem Date: Fri, 22 Nov 2024 21:46:17 +0500 Subject: [PATCH] pkp/pkp-lib#10506 submodules updates, use Eloquent for UserGroup --- api/v1/_dois/BackendDoiController.php | 2 +- api/v1/issues/IssueController.php | 2 +- classes/search/ArticleSearch.php | 2 +- classes/submission/Submission.php | 2 +- .../users/subscriberSelect/SubscriberSelectGridHandler.php | 6 +++--- lib/pkp | 2 +- lib/ui-library | 2 +- plugins/generic/customBlockManager | 2 +- plugins/generic/staticPages | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api/v1/_dois/BackendDoiController.php b/api/v1/_dois/BackendDoiController.php index ff4f7c385a1..90741dc5d52 100644 --- a/api/v1/_dois/BackendDoiController.php +++ b/api/v1/_dois/BackendDoiController.php @@ -146,7 +146,7 @@ public function editIssue(Request $illuminateRequest): JsonResponse protected function getUserGroups(int $contextId): LazyCollection { - return UserGroup::where('contextId', $contextId)->get(); + return UserGroup::withContextIds($contextId)->cursor(); } protected function getGenres(int $contextId): array diff --git a/api/v1/issues/IssueController.php b/api/v1/issues/IssueController.php index 63c6627f441..cfc653b0af0 100644 --- a/api/v1/issues/IssueController.php +++ b/api/v1/issues/IssueController.php @@ -269,7 +269,7 @@ public function get(Request $illuminateRequest): JsonResponse protected function getUserGroups(int $contextId): LazyCollection { - return UserGroup::where('contextId', $contextId)->get(); + return UserGroup::withContextIds($contextId)->cursor(); } diff --git a/classes/search/ArticleSearch.php b/classes/search/ArticleSearch.php index d8f0ba22e07..fa01a6c7207 100644 --- a/classes/search/ArticleSearch.php +++ b/classes/search/ArticleSearch.php @@ -78,7 +78,7 @@ public function getSparseArray($unorderedResults, $orderBy, $orderDir, $exclude) } $i = 0; // Used to prevent ties from clobbering each other - $authorUserGroups = UserGroup::where('roleId', \PKP\security\Role::ROLE_ID_AUTHOR)->get(); + $authorUserGroups = UserGroup::withRoleIds(\PKP\security\Role::ROLE_ID_AUTHOR)->get(); foreach ($unorderedResults as $submissionId => $data) { // Exclude unwanted IDs. diff --git a/classes/submission/Submission.php b/classes/submission/Submission.php index 71862a5821e..7ac3a5d3eba 100644 --- a/classes/submission/Submission.php +++ b/classes/submission/Submission.php @@ -70,7 +70,7 @@ public function _getContextLicenseFieldValue($locale, $field, $publication = nul $publication = $this->getCurrentPublication(); } - $authorUserGroups = UserGroup::where('roleId', \PKP\security\Role::ROLE_ID_AUTHOR)->where('contextId', $context->getId())->get(); + $authorUserGroups = UserGroup::withRoleIds(\PKP\security\Role::ROLE_ID_AUTHOR)->withContextIds($context->getId())->get(); $fieldValue = [$context->getPrimaryLocale() => $publication->getAuthorString($authorUserGroups)]; break; case 'context': diff --git a/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php b/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php index f452e9373e3..dbc29c594ad 100644 --- a/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php +++ b/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php @@ -68,9 +68,9 @@ public function initialize($request, $args = null) $stageId = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_WORKFLOW_STAGE); $contextId = $request->getContext()->getId(); - $userGroups = UserGroup::where('contextId', $contextId) + $userGroups = UserGroup::withContextIds($contextId) ->whereHas('userGroupStages', function ($query) use ($stageId) { - $query->where('stageId', $stageId); + $query->withStageId($stageId); }) ->get(); @@ -153,7 +153,7 @@ protected function loadData($request, $filter) public function renderFilter($request, $filterData = []) { $contextId = $request->getContext()->getId(); - $userGroups = UserGroup::where('contextId', $contextId)->get(); + $userGroups = UserGroup::withContextIds($contextId)->get(); foreach ($userGroups as $userGroup) { $userGroupOptions[$userGroup->id] = $userGroup->getLocalizedData('name'); diff --git a/lib/pkp b/lib/pkp index 8355f0c5b59..08c53ec33f8 160000 --- a/lib/pkp +++ b/lib/pkp @@ -1 +1 @@ -Subproject commit 8355f0c5b59f9d511444ab7c46cfd0d0f5dc1deb +Subproject commit 08c53ec33f830f2203ecb013b63a0baa73612d00 diff --git a/lib/ui-library b/lib/ui-library index b67a68d568a..7bd6e9d60e4 160000 --- a/lib/ui-library +++ b/lib/ui-library @@ -1 +1 @@ -Subproject commit b67a68d568aa4d53c2dc518d46a0794fcdb04a67 +Subproject commit 7bd6e9d60e46992a1fa84e42cce0bf5aa77ee696 diff --git a/plugins/generic/customBlockManager b/plugins/generic/customBlockManager index dd8c68d3355..8222089b14c 160000 --- a/plugins/generic/customBlockManager +++ b/plugins/generic/customBlockManager @@ -1 +1 @@ -Subproject commit dd8c68d33551b37429aa79210d1ec40517f30f63 +Subproject commit 8222089b14c55e89dabdb562a0e063b7e553b1dd diff --git a/plugins/generic/staticPages b/plugins/generic/staticPages index a66ed2b5193..17be34c5913 160000 --- a/plugins/generic/staticPages +++ b/plugins/generic/staticPages @@ -1 +1 @@ -Subproject commit a66ed2b519328179f39306b79fcd5423776d5aba +Subproject commit 17be34c5913a643b05f000e3768bf74f36335618