This commit is contained in:
Alexey Skobkin 2015-06-02 05:39:09 +03:00
parent 94129f3b5c
commit 5bb8c64c98
2 changed files with 14 additions and 3 deletions

View file

@ -67,12 +67,23 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
try {
$serviceSubscribers = $api->getUserSubscribersById($serviceUserId);
} catch (\Exception $e) {
// @todo fallback to the local subscribers list
$output->writeln('Error while getting service subscribers');
$log->error('Error while getting service subscribers.', ['user_login' => $serviceUser->getLogin(), 'user_id' => $serviceUser->getId(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
$serviceSubscribers = [];
foreach ($serviceUser->getSubscribers() as $subscription) {
$serviceSubscribers[] = $subscription->getSubscriber();
}
$output->writeln('Fallback to local list');
$log->error('Fallback to local list');
if (!count($serviceSubscribers)) {
$log->info('No local subscribers. Finishing.');
return false;
}
}
if ($output->isVerbose()) {
$output->writeln('Updating service subscribers');

View file

@ -184,7 +184,7 @@ class User
/**
* Get subscribers
*
* @return ArrayCollection
* @return Subscription[]|ArrayCollection
*/
public function getSubscribers()
{