protected function generateDependencyData($cache)
    {
        $db = $this->db;
        if ($db !== null) {
            $db = Instance::ensure($db);
        }

        if (!$this->query instanceof QueryInterface) {
            throw new InvalidConfigException('"' . get_class($this) . '::$query" should be an instance of "yii\db\QueryInterface".');
        }

        if (!empty($db->enableQueryCache)) {
            // temporarily disable and re-enable query caching
            $originEnableQueryCache = $db->enableQueryCache;
            $db->enableQueryCache = false;
            $result = $this->executeQuery($this->query, $db);
            $db->enableQueryCache = $originEnableQueryCache;
        } else {
            $result = $this->executeQuery($this->query, $db);
        }

        return $result;
    }
protected function generateDependencyData($cache)
    {
        $db = $this->db;
        if ($db !== null) {
            $db = Instance::ensure($db);
        }

        if (!$this->query instanceof QueryInterface) {
            throw new InvalidConfigException('"' . get_class($this) . '::$query" should be an instance of "yii\db\QueryInterface".');
        }

        if (!empty($db->enableQueryCache)) {
            // temporarily disable and re-enable query caching
            $originEnableQueryCache = $db->enableQueryCache;
            $db->enableQueryCache = false;
            $result = $this->executeQuery($this->query, $db);
            $db->enableQueryCache = $originEnableQueryCache;
        } else {
            $result = $this->executeQuery($this->query, $db);
        }

        return $result;
    }
protected function generateDependencyData ( $ cache ) { $ db = $ this -> db ; if ( $ db !== null ) { $ db = Instance :: ensure ( $ db ) ; } if ( ! $ this -> query instanceof QueryInterface ) { throw new InvalidConfigException ( '"' . get_class ( $ this ) . '::$query" should be an instance of "yii\db\QueryInterface".' ) ; } if ( ! empty ( $ db -> enableQueryCache ) ) { // temporarily disable and re-enable query caching $ originEnableQueryCache = $ db -> enableQueryCache ; $ db -> enableQueryCache = false ; $ result = $ this -> executeQuery ( $ this -> query , $ db ) ; $ db -> enableQueryCache = $ originEnableQueryCache ; } else { $ result = $ this -> executeQuery ( $ this -> query , $ db ) ; } return $ result ; }
Generates the data needed to determine if dependency is changed.

This method returns the query result.
@param CacheInterface $cache the cache component that is currently evaluating this dependency
@return mixed the data needed to determine if dependency has been changed.
@throws InvalidConfigException on invalid configuration.
Generates the data needed to determine if dependency is changed .