/** * @return array */ public function getRoutes() { $cache = Yii::$app->{$this->cache}; $routes = $cache->get($this->componentId . '|routes'); if ($routes) { return $routes; } /** @var models\Meta[] $models */ $models = models\Meta::find()->all(Yii::$app->{$this->db}); $routes = []; foreach ($models as $model) { $key = $this->createRouteIndexKey($model->route, $model->params); $routes[$key] = $model->toArray(['id_meta', 'robots_index', 'robots_follow', 'title', 'keywords', 'description']); } $cache->set($this->componentId . '|routes', $routes, $this->cacheDuration); return $routes; }
public function down() { \ptheofan\meta\models\Meta::deleteAll(['hash' => '656c870b90f9469384e15e56292873e0']); }