Skip to content

Enhancement: Merge multiple ResultIterator objects into one #261

Open
@charlesc-ai

Description

@charlesc-ai

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[].

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions