Classes/TcaDataGenerator/RecordFinder.php
public function findPidOfMainTableRecord(string $tableName): int
    {
        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
        $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
        $row = $queryBuilder->select('uid')
            ->from('pages')
            ->where(
                $queryBuilder->expr()->eq(
                    'tx_styleguide_containsdemo',
                    $queryBuilder->createNamedParameter($tableName, \PDO::PARAM_STR)
                )
            )
            ->orderBy('pid', 'DESC')
            ->execute()
            ->fetch();
        if (count($row) !== 1) {
            throw new Exception(
                'Found no page for main table ' . $tableName,
                1457690656
            );
        }
        return (int)$row['uid'];
    }
public function findPidOfMainTableRecord(string $tableName): int
    {
        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
        $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
        $row = $queryBuilder->select('uid')
            ->from('pages')
            ->where(
                $queryBuilder->expr()->eq(
                    'tx_styleguide_containsdemo',
                    $queryBuilder->createNamedParameter($tableName, \PDO::PARAM_STR)
                )
            )
            ->orderBy('pid', 'DESC')
            ->execute()
            ->fetch();
        if (count($row) !== 1) {
            throw new Exception(
                'Found no page for main table ' . $tableName,
                1457690656
            );
        }
        return (int)$row['uid'];
    }
public function findPidOfMainTableRecord ( string $ tableName ) : int { $ queryBuilder = GeneralUtility :: makeInstance ( ConnectionPool :: class ) -> getQueryBuilderForTable ( 'pages' ) ; $ queryBuilder -> getRestrictions ( ) -> removeAll ( ) -> add ( GeneralUtility :: makeInstance ( DeletedRestriction :: class ) ) ; $ row = $ queryBuilder -> select ( 'uid' ) -> from ( 'pages' ) -> where ( $ queryBuilder -> expr ( ) -> eq ( 'tx_styleguide_containsdemo' , $ queryBuilder -> createNamedParameter ( $ tableName , \ PDO :: PARAM_STR ) ) ) -> orderBy ( 'pid' , 'DESC' ) -> execute ( ) -> fetch ( ) ; if ( count ( $ row ) !== 1 ) { throw new Exception ( 'Found no page for main table ' . $ tableName , 1457690656 ) ; } return ( int ) $ row [ 'uid' ] ; }
"Main" tables have a single page they are located on with their possible children.
The methods find this page by getting the highest uid of a page where field
tx_styleguide_containsdemo is set to given table name.

@param string $tableName
@return int
@throws Exception
Main tables have a single page they are located on with their possible children . The methods find this page by getting the highest uid of a page where field tx_styleguide_containsdemo is set to given table name .