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

Method getOwnFavoriteReports

lib/Service/ReportService.php:411–425  ·  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

409 * @throws Exception
410 */
411 public function getOwnFavoriteReports() {
412 $ownReports = $this->ReportMapper->index();
413 $sharedReports = $this->ShareService->getSharedItems(ShareService::SHARE_ITEM_TYPE_REPORT);
414 $favorites = $this->tagManager->load('analytics')->getFavorites();
415
416 // remove the favorite if the report is not existing anymore
417 foreach ($favorites as $favorite) {
418 if (!in_array($favorite, array_column($ownReports, 'id')) && !in_array($favorite, array_column($sharedReports, 'id'))) {
419 unset($favorites[$favorite]);
420 $this->removeFavoriteTag('analytics', $favorite);
421 }
422 }
423
424 return $favorites;
425 }
426
427 /**
428 * 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