mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 05:48:11 +08:00
Renamed application to app.
This commit is contained in:
@ -96,7 +96,7 @@ class ActiveRecord extends Model
|
||||
*/
|
||||
public static function getDb()
|
||||
{
|
||||
return \Yii::$application->getDb();
|
||||
return \Yii::$app->getDb();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -387,7 +387,7 @@ class Command extends \yii\base\Component
|
||||
|
||||
/** @var $cache \yii\caching\Cache */
|
||||
if ($db->enableQueryCache && $method !== '') {
|
||||
$cache = \Yii::$application->getComponent($db->queryCacheID);
|
||||
$cache = \Yii::$app->getComponent($db->queryCacheID);
|
||||
}
|
||||
|
||||
if (isset($cache)) {
|
||||
|
||||
@ -51,7 +51,7 @@ class Migration extends \yii\base\Component
|
||||
{
|
||||
parent::init();
|
||||
if ($this->db === null) {
|
||||
$this->db = \Yii::$application->getComponent('db');
|
||||
$this->db = \Yii::$app->getComponent('db');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ class Query extends \yii\base\Component
|
||||
public function createCommand($db = null)
|
||||
{
|
||||
if ($db === null) {
|
||||
$db = \Yii::$application->db;
|
||||
$db = \Yii::$app->db;
|
||||
}
|
||||
$sql = $db->getQueryBuilder()->build($this);
|
||||
return $db->createCommand($sql, $this->params);
|
||||
|
||||
@ -87,7 +87,7 @@ abstract class Schema extends \yii\base\Object
|
||||
$realName = $this->getRealTableName($name);
|
||||
|
||||
/** @var $cache Cache */
|
||||
if ($db->enableSchemaCache && ($cache = \Yii::$application->getComponent($db->schemaCacheID)) !== null && !in_array($name, $db->schemaCacheExclude, true)) {
|
||||
if ($db->enableSchemaCache && ($cache = \Yii::$app->getComponent($db->schemaCacheID)) !== null && !in_array($name, $db->schemaCacheExclude, true)) {
|
||||
$key = $this->getCacheKey($cache, $name);
|
||||
if ($refresh || ($table = $cache->get($key)) === false) {
|
||||
$table = $this->loadTableSchema($realName);
|
||||
@ -171,7 +171,7 @@ abstract class Schema extends \yii\base\Object
|
||||
public function refresh()
|
||||
{
|
||||
/** @var $cache \yii\caching\Cache */
|
||||
if ($this->db->enableSchemaCache && ($cache = \Yii::$application->getComponent($this->db->schemaCacheID)) !== null) {
|
||||
if ($this->db->enableSchemaCache && ($cache = \Yii::$app->getComponent($this->db->schemaCacheID)) !== null) {
|
||||
foreach ($this->_tables as $name => $table) {
|
||||
$cache->delete($this->getCacheKey($cache, $name));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user