[PR #1] [CLOSED] EntityManager: add setRepository() method #7586

Closed
opened 2026-01-22 15:55:54 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/1
Author: @maxim-oleinik
Created: 9/9/2010
Status: Closed

Base: masterHead: em_set_repo


📝 Commits (1)

  • 0d94f78 EntityManager: add setRepository() method

📊 Changes

1 file changed (+15 additions, -1 deletions)

View changed files

📝 lib/Doctrine/ORM/EntityManager.php (+15 -1)

📄 Description

Goal is to have opportunity to set mocked repo.

// PHPUnit
$repo = $this->getMock('ArticleRepository', array('findActiveByAuthor'), array($em, $metadata));
$repo->expects($this->once())
     ->method('findActiveByAuthor');
$em->setRepository($entityName, $repo);

// Proxy call
$author->getArticles();

🔄 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/1 **Author:** [@maxim-oleinik](https://github.com/maxim-oleinik) **Created:** 9/9/2010 **Status:** ❌ Closed **Base:** `master` ← **Head:** `em_set_repo` --- ### 📝 Commits (1) - [`0d94f78`](https://github.com/doctrine/orm/commit/0d94f78a5e004a89f5ba3f6107822952f920fc68) EntityManager: add setRepository() method ### 📊 Changes **1 file changed** (+15 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/EntityManager.php` (+15 -1) </details> ### 📄 Description Goal is to have opportunity to set mocked repo. <pre> // PHPUnit $repo = $this->getMock('ArticleRepository', array('findActiveByAuthor'), array($em, $metadata)); $repo->expects($this->once()) ->method('findActiveByAuthor'); $em->setRepository($entityName, $repo); // Proxy call $author->getArticles(); </pre> --- <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 15:55:54 +01:00
admin closed this issue 2026-01-22 15:55:54 +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#7586