[PR #1021] [CLOSED] Make EntityRepository iterateable #9043

Open
opened 2026-01-22 16:02:57 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/1021
Author: @nkt
Created: 4/29/2014
Status: Closed

Base: masterHead: allow-iterate-repository


📝 Commits (1)

  • 39be88d Make EntityRepository iterateable

📊 Changes

2 files changed (+21 additions, -1 deletions)

View changed files

📝 lib/Doctrine/ORM/EntityRepository.php (+12 -1)
📝 tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php (+9 -0)

📄 Description

I am often write code like this

foreach ($em->getRepository(User::class)->findAll() as $user) {
    // do smth
}

Its would be wonderful write less code:

foreach ($em->getRepository(User::class) as $user) {
    // do smth
}

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/1021 **Author:** [@nkt](https://github.com/nkt) **Created:** 4/29/2014 **Status:** ❌ Closed **Base:** `master` ← **Head:** `allow-iterate-repository` --- ### 📝 Commits (1) - [`39be88d`](https://github.com/doctrine/orm/commit/39be88da86ce9734e0b2e1c557c73919e2a11d90) Make EntityRepository iterateable ### 📊 Changes **2 files changed** (+21 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/EntityRepository.php` (+12 -1) 📝 `tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php` (+9 -0) </details> ### 📄 Description I am often write code like this ``` php foreach ($em->getRepository(User::class)->findAll() as $user) { // do smth } ``` Its would be wonderful write less code: ``` php foreach ($em->getRepository(User::class) as $user) { // do smth } ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 16:02:57 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9043