src/Versioned.php
protected function getLastEditedAndStageForVersion($version)
    {
        // Cache key
        $baseTable = $this->baseTable();
        $id = $this->owner->ID;
        $key = "{$baseTable}#{$id}/{$version}";

        // Check cache
        if (isset($this->versionModifiedCache[$key])) {
            return $this->versionModifiedCache[$key];
        }

        // Build query
        $table = "\"{$baseTable}_Versions\"";
        $query = SQLSelect::create(['"LastEdited"', '"WasPublished"'], $table)
            ->addWhere([
                "{$table}.\"RecordID\"" => $id,
                "{$table}.\"Version\"" => $version
            ]);
        $result = $query->execute()->record();
        if (!$result) {
            return null;
        }
        $list = [
            $result['LastEdited'],
            $result['WasPublished'] ? static::LIVE : static::DRAFT,
        ];
        $this->versionModifiedCache[$key] = $list;
        return $list;
    }
protected function getLastEditedAndStageForVersion($version)
    {
        // Cache key
        $baseTable = $this->baseTable();
        $id = $this->owner->ID;
        $key = "{$baseTable}#{$id}/{$version}";

        // Check cache
        if (isset($this->versionModifiedCache[$key])) {
            return $this->versionModifiedCache[$key];
        }

        // Build query
        $table = "\"{$baseTable}_Versions\"";
        $query = SQLSelect::create(['"LastEdited"', '"WasPublished"'], $table)
            ->addWhere([
                "{$table}.\"RecordID\"" => $id,
                "{$table}.\"Version\"" => $version
            ]);
        $result = $query->execute()->record();
        if (!$result) {
            return null;
        }
        $list = [
            $result['LastEdited'],
            $result['WasPublished'] ? static::LIVE : static::DRAFT,
        ];
        $this->versionModifiedCache[$key] = $list;
        return $list;
    }
protected function getLastEditedAndStageForVersion ( $ version ) { // Cache key $ baseTable = $ this -> baseTable ( ) ; $ id = $ this -> owner -> ID ; $ key = "{$baseTable}#{$id}/{$version}" ; // Check cache if ( isset ( $ this -> versionModifiedCache [ $ key ] ) ) { return $ this -> versionModifiedCache [ $ key ] ; } // Build query $ table = "\"{$baseTable}_Versions\"" ; $ query = SQLSelect :: create ( [ '"LastEdited"' , '"WasPublished"' ] , $ table ) -> addWhere ( [ "{$table}.\"RecordID\"" => $ id , "{$table}.\"Version\"" => $ version ] ) ; $ result = $ query -> execute ( ) -> record ( ) ; if ( ! $ result ) { return null ; } $ list = [ $ result [ 'LastEdited' ] , $ result [ 'WasPublished' ] ? static :: LIVE : static :: DRAFT , ] ; $ this -> versionModifiedCache [ $ key ] = $ list ; return $ list ; }
Get modified date and stage for the given version

@param int $version
@return array A list containing 0 => LastEdited, 1 => Stage
Get modified date and stage for the given version