connectionPool = $connectionPool; } /** * Returns the website registered matomo site's id * @param int $rootPageUid * @return int|null */ public function getMatomoSiteId(int $rootPageUid) { // Set up a connection to the typo3 DB $queryBuilder = $this->connectionPool->getQueryBuilderForTable('pages'); $matomoId = $queryBuilder ->select('tx_opentalent_matomo_id') ->from('pages') ->where($queryBuilder->expr()->eq('uid', $rootPageUid)) ->andWhere($queryBuilder->expr()->eq('is_siteroot', 1)) ->execute() ->fetchColumn(0); if ($matomoId === false) { throw new \RuntimeException('No existing root page with uid ' . $rootPageUid); } return $matomoId; } }