protected function getDbRoutes($siteId = null): array
    {
        if ($siteId === null) {
            $siteId = Craft::$app->getSites()->currentSite->id;
        }
        if ($siteId === 'global') {
            $siteId = null;
        }
        // If we're on Craft 3.1 or later, just return the array from getProjectConfigRoutes();
        if (RouteMap::$craft31) {
            return Craft::$app->getRoutes()->getProjectConfigRoutes();
        }

        // Normalize the URL
        $results = (new Query())
            ->select(['uriPattern', 'template'])
            ->from(['{{%routes}}'])
            ->where([
                'or',
                ['siteId' => $siteId],
            ])
            ->orderBy(['sortOrder' => SORT_ASC])
            ->all();

        return ArrayHelper::map($results, 'uriPattern', function ($results) {
            return ['template' => $results['template']];
        });
    }
protected function getDbRoutes($siteId = null): array
    {
        if ($siteId === null) {
            $siteId = Craft::$app->getSites()->currentSite->id;
        }
        if ($siteId === 'global') {
            $siteId = null;
        }
        // If we're on Craft 3.1 or later, just return the array from getProjectConfigRoutes();
        if (RouteMap::$craft31) {
            return Craft::$app->getRoutes()->getProjectConfigRoutes();
        }

        // Normalize the URL
        $results = (new Query())
            ->select(['uriPattern', 'template'])
            ->from(['{{%routes}}'])
            ->where([
                'or',
                ['siteId' => $siteId],
            ])
            ->orderBy(['sortOrder' => SORT_ASC])
            ->all();

        return ArrayHelper::map($results, 'uriPattern', function ($results) {
            return ['template' => $results['template']];
        });
    }
protected function getDbRoutes ( $ siteId = null ) : array { if ( $ siteId === null ) { $ siteId = Craft :: $ app -> getSites ( ) -> currentSite -> id ; } if ( $ siteId === 'global' ) { $ siteId = null ; } // If we're on Craft 3.1 or later, just return the array from getProjectConfigRoutes(); if ( RouteMap :: $ craft31 ) { return Craft :: $ app -> getRoutes ( ) -> getProjectConfigRoutes ( ) ; } // Normalize the URL $ results = ( new Query ( ) ) -> select ( [ 'uriPattern' , 'template' ] ) -> from ( [ '{{%routes}}' ] ) -> where ( [ 'or' , [ 'siteId' => $ siteId ] , ] ) -> orderBy ( [ 'sortOrder' => SORT_ASC ] ) -> all ( ) ; return ArrayHelper :: map ( $ results , 'uriPattern' , function ( $ results ) { return [ 'template' => $ results [ 'template' ] ] ; } ) ; }
Query the database for db routes

@param string|int $siteId

@return array
Query the database for db routes