Trait yii\db\ViewFinderTrait
實作於 | yii\db\mssql\Schema, yii\db\pgsql\Schema |
---|---|
自版本起可用 | 2.0.12 |
原始碼 | https://github.com/yiisoft/yii2/blob/master/framework/db/ViewFinderTrait.php |
ViewFinderTrait 實作了 getViewNames 方法,用於在資料庫中尋找視圖。
方法詳情
傳回資料庫中所有視圖名稱。
protected abstract array findViewNames ( $schema = '' ) | ||
$schema | string |
視圖的 Schema。預設為空字串,表示目前的或預設的 Schema。 |
return | array |
資料庫中所有視圖名稱。名稱不帶 Schema 名稱前綴。 |
---|
abstract protected function findViewNames($schema = '');
傳回資料庫中所有視圖名稱。
public string[] getViewNames ( $schema = '', $refresh = false ) | ||
$schema | string |
視圖的 Schema。預設為空字串,表示目前的或預設的 Schema 名稱。若不為空,傳回的視圖名稱將會帶有 Schema 名稱前綴。 |
$refresh | boolean |
是否獲取最新的可用視圖名稱。若為 false,將傳回先前獲取的視圖名稱(如果有的話)。 |
return | string[] |
資料庫中所有視圖名稱。 |
---|
public function getViewNames($schema = '', $refresh = false)
{
if (!isset($this->_viewNames[$schema]) || $refresh) {
$this->_viewNames[$schema] = $this->findViewNames($schema);
}
return $this->_viewNames[$schema];
}
註冊 或 登入 以進行評論。