/** * @inheritdoc */ public static function getDb() { if (Configs::instance()->db !== null) { return Configs::instance()->db; } else { return parent::getDb(); } }
/** * Get core menu * @return array * @var $ids array has 'Menu Lable' => 'Controller' pairs */ protected function getCoreMenus() { $mid = '/' . $this->getUniqueId() . '/'; $ids = ['Assignments' => 'assignment', 'Roles' => 'role', 'Permissions' => 'permission', 'Routes' => 'route', 'Rules' => 'rule', 'Menus' => 'menu']; $config = components\Configs::instance(); $result = []; foreach ($ids as $lable => $id) { if ($id !== 'menu' || $config->db !== null && $config->db->schema->getTableSchema($config->menuTable) !== null) { $result[$id] = ['label' => Yii::t('rbac-admin', $lable), 'url' => [$mid . $id]]; } } foreach (array_keys($this->controllerMap) as $id) { $result[$id] = ['label' => Yii::t('rbac-admin', Inflector::humanize($id)), 'url' => [$mid . $id]]; } return $result; }
/** * Ivalidate cache */ protected function invalidate() { if (Configs::instance()->cache !== null) { TagDependency::invalidate(Configs::instance()->cache, self::CACHE_TAG); } }