Fix #10.
This commit is contained in:
parent
94129f3b5c
commit
5bb8c64c98
|
@ -67,11 +67,22 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
|
||||||
try {
|
try {
|
||||||
$serviceSubscribers = $api->getUserSubscribersById($serviceUserId);
|
$serviceSubscribers = $api->getUserSubscribersById($serviceUserId);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// @todo fallback to the local subscribers list
|
|
||||||
$output->writeln('Error while getting service subscribers');
|
$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()]);
|
$log->error('Error while getting service subscribers.', ['user_login' => $serviceUser->getLogin(), 'user_id' => $serviceUser->getId(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
|
||||||
|
|
||||||
return false;
|
$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()) {
|
if ($output->isVerbose()) {
|
||||||
|
|
|
@ -184,7 +184,7 @@ class User
|
||||||
/**
|
/**
|
||||||
* Get subscribers
|
* Get subscribers
|
||||||
*
|
*
|
||||||
* @return ArrayCollection
|
* @return Subscription[]|ArrayCollection
|
||||||
*/
|
*/
|
||||||
public function getSubscribers()
|
public function getSubscribers()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue