Skip to content

Add ModelCollection->getModels() to get the backing array of the collection#48

Closed
JulianVennen wants to merge 2 commits intomasterfrom
model-collection-getter
Closed

Add ModelCollection->getModels() to get the backing array of the collection#48
JulianVennen wants to merge 2 commits intomasterfrom
model-collection-getter

Conversation

@JulianVennen
Copy link
Member

When selecting models, you often want to have an array of models at the end. ModelCollection exists because queries can return additional data like the number of rows that matched the filter or how long it took to execute the query.

To convert a model collection to an array you previously had to iterate over it and copy the elements into an array. Now you can just call ->getModels() instead.

@JulianVennen JulianVennen requested review from Copilot and matthi4s and removed request for Copilot February 11, 2026 10:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a convenience accessor to retrieve the underlying models array from ModelCollection, avoiding manual iteration/copying when callers need a plain array.

Changes:

  • Documented the $models property as a typed generic array (TModel[]).
  • Added ModelCollection::getModels() to return the internal models array.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JulianVennen JulianVennen deleted the model-collection-getter branch February 11, 2026 10:30
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.

1 participant