/** * {@inheritdoc} */ public function getParameters() { $channels = $this->completenessRepo->getProductsCountPerChannels(); $completeProducts = $this->completenessRepo->getCompleteProductsCountPerChannels(); $params = array(); foreach ($channels as $channel) { $params[$channel['label']] = array('total' => $channel['total'], 'complete' => 0); } foreach ($completeProducts as $completeProduct) { $params[$completeProduct['label']]['locales'][$completeProduct['locale']] = $completeProduct['total']; $params[$completeProduct['label']]['complete'] += $completeProduct['total']; } return array('params' => $params); }
/** * {@inheritdoc} */ public function getData() { $channels = $this->completenessRepo->getProductsCountPerChannels(); $completeProducts = $this->completenessRepo->getCompleteProductsCountPerChannels(); $data = []; foreach ($channels as $channel) { $data[$channel['label']] = ['total' => (int) $channel['total'], 'complete' => 0]; } foreach ($completeProducts as $completeProduct) { $localeLabel = $this->localeHelper->getLocaleLabel($completeProduct['locale']); $data[$completeProduct['label']]['locales'][$localeLabel] = (int) $completeProduct['total']; $data[$completeProduct['label']]['complete'] += $completeProduct['total']; } return $data; }