[PR #1089] [MERGED] EntityRepositoryGenerator default repository #9142

Closed
opened 2026-01-22 16:03:22 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/1089
Author: @encoder32
Created: 7/27/2014
Status: Merged
Merged: 11/11/2014
Merged by: @Ocramius

Base: masterHead: EntityRepositoryGeneratorDefaultRepository


📝 Commits (10+)

  • c0ee57a Default/Custom Entity Repository for Entity Repository Generator
  • 90efaee Code Style fixes
  • 3dc2a68 simple fixes
  • c04b01c Added NS checking
  • a4c7a89 className fix: If namespace is not set then ClassName will be cut of
  • 5d608b6 Private method EntityRepositoryGenerator::generateEntityRepositoryNamespace() changed to protected
  • df80d82 Reverted visibility for EntityRepositoryGenerator::generateEntityRepositoryNamespace()
  • 20b72ef Visibility for EntityRepositoryGenerator::$repositoryName
  • c8565c2 Visibility for EntityRepositoryGenerator::generateClassName()
  • dc3bc45 Merge remote-tracking branch 'upstream/master' into EntityRepositoryGeneratorDefaultRepository

📊 Changes

9 files changed (+511 additions, -9 deletions)

View changed files

📝 lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php (+4 -0)
📝 lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php (+73 -9)
tests/Doctrine/Tests/Models/DDC3231/DDC3231EntityRepository.php (+7 -0)
tests/Doctrine/Tests/Models/DDC3231/DDC3231User1.php (+23 -0)
tests/Doctrine/Tests/Models/DDC3231/DDC3231User1NoNamespace.php (+21 -0)
tests/Doctrine/Tests/Models/DDC3231/DDC3231User2.php (+23 -0)
tests/Doctrine/Tests/Models/DDC3231/DDC3231User2NoNamespace.php (+21 -0)
tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php (+143 -0)
tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php (+196 -0)

📄 Description

  1. I set default repository class in configuration to MyApp\Doctrine\DefaultRepository
  2. I created entity class MyApp\Entity\TestEntity and generated repository class for it
  3. Actually the repository class "MyApp\Entity\TestEntityRepository" turned out to be a descendant of "Doctrine\ORM\EntityRepository" when I expected "MyApp\Doctrine\DefaultRepository" as default.

Related pull https://github.com/doctrine/DoctrineBundle/pull/315


🔄 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/1089 **Author:** [@encoder32](https://github.com/encoder32) **Created:** 7/27/2014 **Status:** ✅ Merged **Merged:** 11/11/2014 **Merged by:** [@Ocramius](https://github.com/Ocramius) **Base:** `master` ← **Head:** `EntityRepositoryGeneratorDefaultRepository` --- ### 📝 Commits (10+) - [`c0ee57a`](https://github.com/doctrine/orm/commit/c0ee57ae55157d2258549ae5c0d13e4bcd3668a6) Default/Custom Entity Repository for Entity Repository Generator - [`90efaee`](https://github.com/doctrine/orm/commit/90efaeec42043ae85d68be8291dc7836a2fc2456) Code Style fixes - [`3dc2a68`](https://github.com/doctrine/orm/commit/3dc2a6858389bee62b9cee5f7695818cce77f73c) simple fixes - [`c04b01c`](https://github.com/doctrine/orm/commit/c04b01cbd7e496dae2d04fbf2cd84dea37498148) Added NS checking - [`a4c7a89`](https://github.com/doctrine/orm/commit/a4c7a895077f46111a4b63686d87b6b22e66c88d) className fix: If namespace is not set then ClassName will be cut of - [`5d608b6`](https://github.com/doctrine/orm/commit/5d608b62069eaaa58b4a0d1a7a8f6fd6d0371b10) Private method EntityRepositoryGenerator::generateEntityRepositoryNamespace() changed to protected - [`df80d82`](https://github.com/doctrine/orm/commit/df80d82aab48ec70cf4705fa75a9cefe06544abd) Reverted visibility for EntityRepositoryGenerator::generateEntityRepositoryNamespace() - [`20b72ef`](https://github.com/doctrine/orm/commit/20b72ef344e1d6af17c89644e667d75904ec9b90) Visibility for EntityRepositoryGenerator::$repositoryName - [`c8565c2`](https://github.com/doctrine/orm/commit/c8565c2772a848c879f0a8147847bf81c290bc89) Visibility for EntityRepositoryGenerator::generateClassName() - [`dc3bc45`](https://github.com/doctrine/orm/commit/dc3bc45d1d36ba32ba33af167f1e1defb906f51f) Merge remote-tracking branch 'upstream/master' into EntityRepositoryGeneratorDefaultRepository ### 📊 Changes **9 files changed** (+511 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Tools/Console/Command/GenerateRepositoriesCommand.php` (+4 -0) 📝 `lib/Doctrine/ORM/Tools/EntityRepositoryGenerator.php` (+73 -9) ➕ `tests/Doctrine/Tests/Models/DDC3231/DDC3231EntityRepository.php` (+7 -0) ➕ `tests/Doctrine/Tests/Models/DDC3231/DDC3231User1.php` (+23 -0) ➕ `tests/Doctrine/Tests/Models/DDC3231/DDC3231User1NoNamespace.php` (+21 -0) ➕ `tests/Doctrine/Tests/Models/DDC3231/DDC3231User2.php` (+23 -0) ➕ `tests/Doctrine/Tests/Models/DDC3231/DDC3231User2NoNamespace.php` (+21 -0) ➕ `tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php` (+143 -0) ➕ `tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php` (+196 -0) </details> ### 📄 Description 1) I set default repository class in configuration to MyApp\Doctrine\DefaultRepository 2) I created entity class MyApp\Entity\TestEntity and generated repository class for it 3) Actually the repository class "MyApp\Entity\TestEntityRepository" turned out to be a descendant of "Doctrine\ORM\EntityRepository" when I expected "MyApp\Doctrine\DefaultRepository" as default. Related pull https://github.com/doctrine/DoctrineBundle/pull/315 --- <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:03:22 +01:00
admin closed this issue 2026-01-22 16:03:23 +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#9142