/** * @return \yii\db\ActiveQuery */ public function getRoute() { return $this->hasOne(Route::className(), ['id' => 'route_id']); }
public static function getRoutes() { if (static::$routes === null) { $cacheKey = "Routes:all"; static::$routes = Yii::$app->cache->get($cacheKey); if (!is_array(static::$routes)) { static::$routes = Route::find()->all(); foreach (static::$routes as $key => $route) { static::$routes[$key]['template'] = json_decode($route->url_template, true); } Yii::$app->cache->set($cacheKey, static::$routes, 86400, new TagDependency(['tags' => [\devgroup\TagDependencyHelper\ActiveRecordHelper::getCommonTag(Route::className())]])); } } return static::$routes; }
/** * @return \yii\db\ActiveQuery */ public function getRoutes() { return $this->hasMany(Route::className(), ['author_id' => 'id']); }