protected function sentNotifications($byUserIndex) { foreach ($byUserIndex as $userURI => $groupedComments) { try { $this->notifyService->notify('CommentsDigestNotification', $userURI, ['groupedComments' => $groupedComments]); sleep(1); } catch (\Exception $e) { echo 'Problem with notification for ' . $userURI; var_dump((string) $e); } } }
protected function execute(InputInterface $input, OutputInterface $output) { $case = $input->getArgument('case'); switch ($case) { case 'my': $this->subscribersMiner->disableAllMiners(); $this->subscribersMiner->enableMiner('Soil\\CommentsDigestBundle\\SubscribersMiner\\AnswersMiner'); $this->subscribersMiner->enableMiner('Soil\\CommentsDigestBundle\\SubscribersMiner\\EntityAuthorsMiner'); break; case 'important': $this->subscribersMiner->disableAllMiners(); $this->subscribersMiner->enableMiner('Soil\\CommentsDigestBundle\\SubscribersMiner\\ImportantForMeEntitiesMiner'); break; case 'all': default: $case = 'all'; } $this->logger->addInfo('Aggregation case ' . $case); $subscribersIndex = $this->subscribersMiner->mine($input->getArgument('period')); // $forUser = $subscribersIndex->getForSubscriber("http://www.talaka.by/user/8785"); $byUserIndex = $subscribersIndex->getBySubscriberIndex(); // $userURI = 'http://www.talaka.by/user/12626'; // $userIndex = $byUserIndex[$userURI]; // var_dump($userIndex); // // $this->notifyService->notify('CommentsDigestNotification', $userURI, [ // 'groupedComments' => $userIndex // ]); // exit(); foreach ($byUserIndex as $userURI => $groupedComments) { try { $this->notifyService->notify('CommentsDigestNotification', $userURI, ['groupedComments' => $groupedComments]); sleep(1); } catch (\Exception $e) { echo 'Problem with notification for ' . $userURI; var_dump((string) $e); } } // $subscribersList = $this->subscribersReducer->reduce($subscribersList); }