src/Extension/FluentVersionedExtension.php
public static function prepoulateIdsInLocale($locale, $dataObjectClass, $populateLive = true, $populateDraft = true)
    {
        // Get the table for the given DataObject class
        /** @var DataObject|FluentExtension $dataObject */
        $dataObject = DataObject::singleton($dataObjectClass);
        $table = $dataObject->getLocalisedTable($dataObject->baseTable());

        // If we already have items then we've been here before...
        if (isset(self::$idsInLocaleCache[$locale][$table])) {
            return;
        }

        $tables = [];
        if ($populateDraft) {
            $tables[] = $table;
        }
        if ($populateLive) {
            $tables[] = $table . self::SUFFIX_LIVE;
        }

        // Populate both the draft and live stages
        foreach ($tables as $table) {
            /** @var SQLSelect $select */
            $select = SQLSelect::create(
                ['"RecordID"'],
                '"' . $table . '"',
                ['"Locale"' => $locale]
            );
            $result = $select->execute();
            $ids = $result->column('RecordID');

            // We need to execute ourselves as the param is lost from the subSelect
            self::$idsInLocaleCache[$locale][$table] = array_combine($ids, $ids);
            self::$idsInLocaleCache[$locale][$table]['_complete'] = true;
        }
    }
public static function prepoulateIdsInLocale($locale, $dataObjectClass, $populateLive = true, $populateDraft = true)
    {
        // Get the table for the given DataObject class
        /** @var DataObject|FluentExtension $dataObject */
        $dataObject = DataObject::singleton($dataObjectClass);
        $table = $dataObject->getLocalisedTable($dataObject->baseTable());

        // If we already have items then we've been here before...
        if (isset(self::$idsInLocaleCache[$locale][$table])) {
            return;
        }

        $tables = [];
        if ($populateDraft) {
            $tables[] = $table;
        }
        if ($populateLive) {
            $tables[] = $table . self::SUFFIX_LIVE;
        }

        // Populate both the draft and live stages
        foreach ($tables as $table) {
            /** @var SQLSelect $select */
            $select = SQLSelect::create(
                ['"RecordID"'],
                '"' . $table . '"',
                ['"Locale"' => $locale]
            );
            $result = $select->execute();
            $ids = $result->column('RecordID');

            // We need to execute ourselves as the param is lost from the subSelect
            self::$idsInLocaleCache[$locale][$table] = array_combine($ids, $ids);
            self::$idsInLocaleCache[$locale][$table]['_complete'] = true;
        }
    }
public static function prepoulateIdsInLocale ( $ locale , $ dataObjectClass , $ populateLive = true , $ populateDraft = true ) { // Get the table for the given DataObject class /** @var DataObject|FluentExtension $dataObject */ $ dataObject = DataObject :: singleton ( $ dataObjectClass ) ; $ table = $ dataObject -> getLocalisedTable ( $ dataObject -> baseTable ( ) ) ; // If we already have items then we've been here before... if ( isset ( self :: $ idsInLocaleCache [ $ locale ] [ $ table ] ) ) { return ; } $ tables = [ ] ; if ( $ populateDraft ) { $ tables [ ] = $ table ; } if ( $ populateLive ) { $ tables [ ] = $ table . self :: SUFFIX_LIVE ; } // Populate both the draft and live stages foreach ( $ tables as $ table ) { /** @var SQLSelect $select */ $ select = SQLSelect :: create ( [ '"RecordID"' ] , '"' . $ table . '"' , [ '"Locale"' => $ locale ] ) ; $ result = $ select -> execute ( ) ; $ ids = $ result -> column ( 'RecordID' ) ; // We need to execute ourselves as the param is lost from the subSelect self :: $ idsInLocaleCache [ $ locale ] [ $ table ] = array_combine ( $ ids , $ ids ) ; self :: $ idsInLocaleCache [ $ locale ] [ $ table ] [ '_complete' ] = true ; } }
Prepopulate the cache of IDs in a locale, to optimise batch calls to isLocalisedInStage.

@param string $locale
@param string $dataObjectClass
@param bool $populateLive
@param bool $populateDraft
Prepopulate the cache of IDs in a locale to optimise batch calls to isLocalisedInStage .