Skip to content

With multiple Entity Managers (EM) the Repository uses only the mapped EM for the Entity #9878

Closed
@bigs21

Description

@bigs21

In the manual page How to Work with multiple Entity Managers and Connections for Symfony 4, we can see in the end the following code snippet:

        // Retrieves a repository managed by the "customer" em
        $customers = $this->getDoctrine()
            ->getRepository(Customer::class, 'customer')
            ->findAll()
        ;

Using the ORM configuration code indicated in the beginning of that document, where the Customer entity is mapped to the 'customer' entity manager, the 'customer' parameter for the getRepository() method is ignored.
As so, this last code about repository calls should be updated.

Also, I suggest to add the code on how to use multiple entity managers for a single Entity, or to add a note that it's not possible if that's the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DoctrineactionableClear and specific issues ready for anyone to take them.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions