Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#10506 user group to use eloquent model #4526

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Hafsa-Naeem
Copy link

No description provided.

@Hafsa-Naeem Hafsa-Naeem force-pushed the ojs_i10506_UserGroup_to_Use_Eloquent_Model branch from ba596b3 to 0a46028 Compare November 18, 2024 14:01
@Vitaliy-1
Copy link
Contributor

@Hafsa-Naeem, this won't trigger tests. The update of submodule should be the last commit with the message:

Submodule update ##Hafsa-Naeem/i10506_UserGroup_to_Use_Eloquent_Model##

All branches in submodule should have the same name: https://docs.pkp.sfu.ca/dev/testing/en/continuous-integration#tests-for-pull-requests
And you would need to rebase all to current state of main branches

Copy link
Contributor

@Vitaliy-1 Vitaliy-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @Hafsa-Naeem! I left minor comments. Submodule updates require specific commit message and this commit should be last. I. think you can reset the last commit and divide it into 2 separate with the last one to include submodule updates to the shared library, ui library and plugins

$contextId = $request->getContext()->getId();

$userGroups = UserGroup::withContextIds($contextId)
->whereHas('userGroupStages', function ($query) use ($stageId) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you already created helper in the Repository:

PKP\userGroup\Repository::getUserGroupsByStage()

The second option is just use the scope, that is also already created:

UserGroup::withContextIds([$contextId])->withStageIds([$stageId]);

);
$contextId = $request->getContext()->getId();

$userGroups = UserGroup::withContextIds($contextId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UserGroup::withContextIds([$contextId])

->filterByContextIds([$context->getId()])
->getMany();
$contextId = $request->getContext()->getId();
$userGroups = UserGroup::withContextIds($contextId)->get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UserGroup::withContextIds([$contextId])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants