Anonymous Anonymous - 2 months ago
511 0

How to add a repository as a service in Symfony2

YAML

Add repository service

services:
    mybundle.myentity.repository:
        class: MyBundle\Repository\MyEntityRepository
        factory: ['@doctrine.orm.default_entity_manager', getRepository]
        arguments:
            - MyBundle\Entity\MyEntity