Trait yii\db\ViewFinderTrait
Implemented by | yii\db\mssql\Schema, yii\db\pgsql\Schema |
---|---|
Available since version | 2.0.12 |
Source Code | https://github.com/yiisoft/yii2/blob/master/framework/db/ViewFinderTrait.php |
ViewFinderTrait implements the method getViewNames for finding views in a database.
Public Methods
Method | Description | Defined By |
---|---|---|
getViewNames() | Returns all view names in the database. | yii\db\ViewFinderTrait |
Protected Methods
Method | Description | Defined By |
---|---|---|
findViewNames() | Returns all views names in the database. | yii\db\ViewFinderTrait |
Method Details
Returns all views names in the database.
protected abstract array findViewNames ( $schema = '' ) | ||
$schema | string |
The schema of the views. Defaults to empty string, meaning the current or default schema. |
return | array |
All views names in the database. The names have NO schema name prefix. |
---|
abstract protected function findViewNames($schema = '');
Returns all view names in the database.
public string[] getViewNames ( $schema = '', $refresh = false ) | ||
$schema | string |
The schema of the views. Defaults to empty string, meaning the current or default schema name. If not empty, the returned view names will be prefixed with the schema name. |
$refresh | boolean |
Whether to fetch the latest available view names. If this is false, view names fetched previously (if available) will be returned. |
return | string[] |
All view names in the database. |
---|
public function getViewNames($schema = '', $refresh = false)
{
if (!isset($this->_viewNames[$schema]) || $refresh) {
$this->_viewNames[$schema] = $this->findViewNames($schema);
}
return $this->_viewNames[$schema];
}
Signup or Login in order to comment.