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

Enhancement: Merge multiple ResultIterator objects into one #261

Open
charlesc-ai opened this issue Jun 24, 2021 · 0 comments
Open

Enhancement: Merge multiple ResultIterator objects into one #261

charlesc-ai opened this issue Jun 24, 2021 · 0 comments

Comments

@charlesc-ai
Copy link

charlesc-ai commented Jun 24, 2021

Question: how to merge 3 User[]|ResultIterator ? without breaking the object structure?
Pagination and sort issues should be considered.

Example:
$usersGroup1 = $this->userDao->getAvailableCaptains();
$usersGroup2 = $this->userDao->getAvailableCoCaptains();
$usersGroup3 = $this->userDao->getAvailableTrainees();

Target: merge into 1 usersGroup, return for GraphQL usage

Current solution:

  1. (better choice) Create one SQL query instead of 3
  2. If the results are relatively small without pagination, we can do "$usersGroup1->toArray()" then array_merge() with other arrays, then finally return an array of merged User[].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants