Now injecting UserRepository into UpdateSubscriptionsCommand. UpdateSubscriptionsCommand still depends on EntityManager because of transactions.

This commit is contained in:
Alexey Skobkin 2017-01-11 18:51:56 +03:00
parent ff38cbc278
commit 55b5aaa1a2
2 changed files with 6 additions and 1 deletions

View file

@ -71,6 +71,11 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
$this->em = $em; $this->em = $em;
} }
public function setUserRepository(UserRepository $repository)
{
$this->userRepo = $repository;
}
public function setApiClient(UserApi $userApi) public function setApiClient(UserApi $userApi)
{ {
$this->api = $userApi; $this->api = $userApi;
@ -116,7 +121,6 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$this->input = $input; $this->input = $input;
$this->userRepo = $this->em->getRepository('SkobkinPointToolsBundle:User');
$this->logger->debug('UpdateSubscriptionsCommand started.'); $this->logger->debug('UpdateSubscriptionsCommand started.');

View file

@ -52,6 +52,7 @@ services:
calls: calls:
- [setLogger, ['@logger']] - [setLogger, ['@logger']]
- [setEntityManager, ['@doctrine.orm.entity_manager']] - [setEntityManager, ['@doctrine.orm.entity_manager']]
- [setUserRepository, ['@app.point.user_repository']]
- [setApiClient, ['@app.point.api_user']] - [setApiClient, ['@app.point.api_user']]
- [setApiDelay, ['%point_api_delay%']] - [setApiDelay, ['%point_api_delay%']]
- [setSubscriptionManager, ['@app.point.subscriptions_manager']] - [setSubscriptionManager, ['@app.point.subscriptions_manager']]