protected function execute(InputInterface $input, OutputInterface $output) { $this->logger->addInfo('Config info:'); foreach ($this->configInfo as $name => $value) { $this->logger->addInfo($name . ': ' . $value); } $availablePeriods = [4, 8, 24, 168]; foreach ($availablePeriods as $period) { if ($period === 168) { if (date('D') !== 'Tue') { continue; } if (date('H') < 17) { continue; } } $subscribersIndex = $this->subscribersMiner->mine($period); $this->sentNotifications($subscribersIndex->getBySubscriberIndex()); } }
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); }