Fix #14.
This commit is contained in:
parent
f353949e6d
commit
24d2ae468a
|
@ -16,6 +16,7 @@ parameters:
|
||||||
point_api_base_url: https://point.im/api/
|
point_api_base_url: https://point.im/api/
|
||||||
point_use_https: true
|
point_use_https: true
|
||||||
point_login: point-tools
|
point_login: point-tools
|
||||||
|
point_id: 435
|
||||||
|
|
||||||
locale: en
|
locale: en
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,14 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
|
||||||
/** @var SubscriptionsManager $subscriptionsManager */
|
/** @var SubscriptionsManager $subscriptionsManager */
|
||||||
$subscriptionsManager = $this->getContainer()->get('skobkin_point_tools.subscriptions_manager');
|
$subscriptionsManager = $this->getContainer()->get('skobkin_point_tools.subscriptions_manager');
|
||||||
|
|
||||||
$serviceUserName = $this->getContainer()->getParameter('point_login');
|
try {
|
||||||
$serviceUser = $this->getContainer()->get('doctrine.orm.entity_manager')->getRepository('SkobkinPointToolsBundle:User')->findOneBy(['login' => $serviceUserName]);
|
$serviceUserId = $this->getContainer()->getParameter('point_id');
|
||||||
|
} catch (\InvalidArgumentException $e) {
|
||||||
|
$log->alert('Could not get point_id parameter from config file', ['exception_message' => $e->getMessage()]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$serviceUser = $this->getContainer()->get('doctrine.orm.entity_manager')->getRepository('SkobkinPointToolsBundle:User')->find($serviceUserId);
|
||||||
|
|
||||||
if (!$serviceUser) {
|
if (!$serviceUser) {
|
||||||
$log->info('Service user not found');
|
$log->info('Service user not found');
|
||||||
|
@ -59,7 +65,7 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$serviceSubscribers = $api->getUserSubscribersByLogin($serviceUserName);
|
$serviceSubscribers = $api->getUserSubscribersById($serviceUserId);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// @todo fallback to the local subscribers list
|
// @todo fallback to the local subscribers list
|
||||||
$output->writeln('Error while getting service subscribers');
|
$output->writeln('Error while getting service subscribers');
|
||||||
|
@ -97,7 +103,7 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
|
||||||
$log->info('Processing @' . $user->getLogin());
|
$log->info('Processing @' . $user->getLogin());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$userCurrentSubscribers = $api->getUserSubscribersByLogin($user->getLogin());
|
$userCurrentSubscribers = $api->getUserSubscribersById($user->getId());
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$output->writeln(' Error while getting subscribers. Skipping.');
|
$output->writeln(' Error while getting subscribers. Skipping.');
|
||||||
$log->error('Error while getting subscribers.' . PHP_EOL .
|
$log->error('Error while getting subscribers.' . PHP_EOL .
|
||||||
|
|
Loading…
Reference in a new issue