Skip to content

[doctrine] Suggest fetching repository from test container in test classes - #305

Merged
TomasVotruba merged 1 commit into
mainfrom
doctrine-repository-test-message
Sep 23, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
doctrine-repository-test-message

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

In test classes there is no constructor injection, so the generic "use constructor injection" hint is confusing.

NoGetRepositoryOutsideServiceRule now emits a test-specific message when the getRepository() call happens in a test class (detected via TestClassDetector):

Instead of getting repository from EntityManager, fetch the repository service directly from the test container

Non-test code keeps the original message.

@TomasVotruba
TomasVotruba merged commit 407fc99 into main Sep 23, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the doctrine-repository-test-message branch September 23, 2026 11:21
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