MCPcopy Create free account
hub / github.com/Rello/analytics / getOwnFavoriteReports

Method getOwnFavoriteReports

lib/Service/ReportService.php:378–392  ·  view source on GitHub ↗

* get own reports which are marked as favorites * * @return array|bool * @throws Exception */

()

Source from the content-addressed store, hash-verified

376 * @throws Exception
377 */
378 public function getOwnFavoriteReports() {
379 $ownReports = $this->ReportMapper->index();
380 $sharedReports = $this->ShareService->getSharedItems(ShareService::SHARE_ITEM_TYPE_REPORT);
381 $favorites = $this->tagManager->load('analytics')->getFavorites();
382
383 // remove the favorite if the report is not existing anymore
384 foreach ($favorites as $favorite) {
385 if (!in_array($favorite, array_column($ownReports, 'id')) && !in_array($favorite, array_column($sharedReports, 'id'))) {
386 unset($favorites[$favorite]);
387 $this->removeFavoriteTag('analytics', $favorite);
388 }
389 }
390
391 return $favorites;
392 }
393
394 /**
395 * set/remove the favorite flag for a report

Callers

nothing calls this directly

Calls 5

removeFavoriteTagMethod · 0.95
getSharedItemsMethod · 0.80
getFavoritesMethod · 0.80
indexMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected