Reputation: 33
I want to link one service container to another, that is already exist, for example:
acme.user.repository:
class: '%acme.user.repository.class%'
arguments: ['%acme.user.repository.argument%']
factory_service: doctrine.orm.entity_manager
factory_method: getRepository
Now I want to link this service to another, something like this:
acme.admin.repository = acme.user.repository
So, I will get the same instance when I call $container->get('acme.admin.repository');
as when I call $container->get('acme.user.repository');
Upvotes: 1
Views: 764
Reputation: 48865
Use an alias to avoid certain problems:
services:
acme.admin.repository:
alias: acme.user.repository
Upvotes: 2
Reputation: 18836
I think you can link your services this way:
acme.admin.repository: '@acme.user.repository'
Upvotes: 1