|
@@ -21,8 +21,6 @@ class StatsSettingsRepository extends PageRepository
|
|
|
* @return int|null
|
|
* @return int|null
|
|
|
*/
|
|
*/
|
|
|
public function getMatomoSiteId(int $rootPageUid) {
|
|
public function getMatomoSiteId(int $rootPageUid) {
|
|
|
- $rootPageUid = $this->getPage($rootPageUid);
|
|
|
|
|
-
|
|
|
|
|
// Set up a connection to the typo3 DB
|
|
// Set up a connection to the typo3 DB
|
|
|
$cnnPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
$cnnPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
|
$queryBuilder = $cnnPool->getQueryBuilderForTable('pages');
|
|
$queryBuilder = $cnnPool->getQueryBuilderForTable('pages');
|
|
@@ -30,8 +28,12 @@ class StatsSettingsRepository extends PageRepository
|
|
|
->select('tx_opentalent_matomo_id')
|
|
->select('tx_opentalent_matomo_id')
|
|
|
->from('pages')
|
|
->from('pages')
|
|
|
->where($queryBuilder->expr()->eq('uid', $rootPageUid))
|
|
->where($queryBuilder->expr()->eq('uid', $rootPageUid))
|
|
|
|
|
+ ->andWhere($queryBuilder->expr()->eq('is_siteroot', 1))
|
|
|
->execute()
|
|
->execute()
|
|
|
->fetchColumn(0);
|
|
->fetchColumn(0);
|
|
|
|
|
+ if ($matomoId === false) {
|
|
|
|
|
+ throw new \RuntimeException('No existing root page with uid ' . $rootPageUid);
|
|
|
|
|
+ }
|
|
|
return $matomoId;
|
|
return $matomoId;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|