Skip to content

ManagerRegistry#getRepository() does not use getManagerForClass() internally #45

@mnapoli

Description

@mnapoli

Assuming the Foo class is not in the default entity manager:

  • works:
$objectManager = $managerRegistry->getManagerForClass(Foo::class);
$repository = $objectManager->getRepository(Foo::class);
  • works:
$repository = $managerRegistry->getRepository(Foo::class, <manager name>);
  • doesn't work (because Foo is looked into the default manager):
$repository = $managerRegistry->getRepository(Foo::class);

I would have thought the 3rd case would work: after all the manager registry can retrieve the correct manager using getManagerForClass() internally.


Would it make sense to have getRepository() use getManagerForClass() internally to retrieve the repository in the correct manager?

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions