To do that, you must declare repository as a service and inject services which you need into it. cities_repository: class: MY\EntityBundle\Entity\CitiesRepository arguments: [MYEntityBundle:Cities] factory_service: doctrine.orm.entity_manager factory_method: getRepository calls: - [ setCanonicalizer, [ @util.canonicalizer ] ] The repository class: namespace MY\EntityBundle\Entity; use Doctrine\ORM