getRepository() doesn't use specified persistentManagerName connection #6839

Closed
opened 2026-01-22 15:39:49 +01:00 by admin · 1 comment
Owner

Originally created by @sterichards on GitHub (Oct 2, 2021).

Bug Report

Q A
BC Break yes/no
Version 2.9.5

Summary

Passing in the 2nd parameter of getRepository() as a connection name doesn't attempt t use that connection

Current behavior

How to reproduce

$this->getDoctrine()->getRepository(Entity::class, 'ConnectionDefinedInDoctrineCOnfig')->findAll();

Expected behavior

Doctrine to use the connection URL defined in the config

Originally created by @sterichards on GitHub (Oct 2, 2021). ### Bug Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | yes/no | Version | 2.9.5 #### Summary Passing in the 2nd parameter of getRepository() as a connection name doesn't attempt t use that connection #### Current behavior <!-- What is the current (buggy) behavior? --> #### How to reproduce $this->getDoctrine()->getRepository(Entity::class, 'ConnectionDefinedInDoctrineCOnfig')->findAll(); #### Expected behavior Doctrine to use the connection URL defined in the config
admin closed this issue 2026-01-22 15:39:49 +01:00
Author
Owner

@sterichards commented on GitHub (Oct 2, 2021):

I have fixed this by changing the order of the entity_manager definitions in the orm section of doctrine.yaml

Defining default first causes the issue. Once I defined the custom entity manager first, everything worked

@sterichards commented on GitHub (Oct 2, 2021): I have fixed this by changing the order of the entity_manager definitions in the `orm` section of doctrine.yaml Defining `default` first causes the issue. Once I defined the custom entity manager first, everything worked
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6839