| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace Opentalent\OtStats\Settings;
- use TYPO3\CMS\Core\Database\ConnectionPool;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- use TYPO3\CMS\Frontend\Page\PageRepository;
- /**
- * Class StatsRepository
- *
- * Give access to the website's settings for the stats module
- *
- * @package Opentalent\OtTemplating\Page
- */
- class StatsSettingsRepository extends PageRepository
- {
- /**
- * Returns the website registered matomo site's id
- * @param int $rootPageUid
- * @return int|null
- */
- public function getMatomoSiteId(int $rootPageUid) {
- $rootPageUid = $this->getPage($rootPageUid);
- // Set up a connection to the typo3 DB
- $cnnPool = GeneralUtility::makeInstance(ConnectionPool::class);
- $queryBuilder = $cnnPool->getQueryBuilderForTable('pages');
- $matomoId = $queryBuilder
- ->select('tx_opentalent_matomo_id')
- ->from('pages')
- ->where($queryBuilder->expr()->eq('uid', $rootPageUid))
- ->execute()
- ->fetchColumn(0);
- return $matomoId;
- }
- }
|