Skip to content

Commit

Permalink
pkp/pkp-lib#10506 submodules updates, use Eloquent for UserGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
Hafsa-Naeem committed Nov 22, 2024
1 parent 0a46028 commit 5795fa9
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion api/v1/_dois/BackendDoiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/v1/issues/IssueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

}

Expand Down
2 changes: 1 addition & 1 deletion classes/search/ArticleSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion classes/submission/Submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 243 files
2 changes: 1 addition & 1 deletion lib/ui-library
Submodule ui-library updated 182 files

0 comments on commit 5795fa9

Please sign in to comment.