/** * Returns all db-stored variations in array representation * * @param bool $force True if you want to refresh static-variable cache * @return array */ public static function getAllVariations($force = false) { if (static::$allVariations === null || $force === true) { $cacheKey = 'AllThemeVariations'; static::$allVariations = Yii::$app->cache->get($cacheKey); if (static::$allVariations === false) { static::$allVariations = ThemeVariation::find()->orderBy(['exclusive' => SORT_DESC])->asArray()->all(); Yii::$app->cache->set($cacheKey, static::$allVariations, 86400, new TagDependency(['tags' => [ActiveRecordHelper::getCommonTag(ThemeVariation::className())]])); } } return static::$allVariations; }