diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 03d6b0c4c46..e981faa8227 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -81,6 +81,7 @@ Yii Framework 2 Change Log - Enh #13976: Disabled IPv6 check on `\yii\validators\IpValidator` as it turns out it is not needed for inet_* methods to work (mikk150) - Enh #13981: `yii\caching\Cache::getOrSet()` now supports both `Closure` and `callable` (silverfire) - Enh #13911: Significantly enhanced MSSQL schema reading performance (paulzi, WebdevMerlion) +- Enh #14059: Removed unused AR instantiating for calling of static methods (ElisDN) 2.0.11.2 February 08, 2017 -------------------------- diff --git a/framework/db/mssql/QueryBuilder.php b/framework/db/mssql/QueryBuilder.php index 6cccd40d8df..f8cfa33ea53 100644 --- a/framework/db/mssql/QueryBuilder.php +++ b/framework/db/mssql/QueryBuilder.php @@ -276,9 +276,8 @@ protected function getAllColumnNames($modelClass = null) if (!$modelClass) { return null; } - /* @var $model \yii\db\ActiveRecord */ - $model = new $modelClass; - $schema = $model->getTableSchema(); + /* @var $modelClass \yii\db\ActiveRecord */ + $schema = $modelClass::getTableSchema(); return array_keys($schema->columns); } diff --git a/framework/test/BaseActiveFixture.php b/framework/test/BaseActiveFixture.php index 72138762541..e3b60920eef 100644 --- a/framework/test/BaseActiveFixture.php +++ b/framework/test/BaseActiveFixture.php @@ -65,10 +65,8 @@ public function getModel($name) $row = $this->data[$name]; /* @var $modelClass \yii\db\ActiveRecord */ $modelClass = $this->modelClass; - /* @var $model \yii\db\ActiveRecord */ - $model = new $modelClass; $keys = []; - foreach ($model->primaryKey() as $key) { + foreach ($modelClass::primaryKey() as $key) { $keys[$key] = isset($row[$key]) ? $row[$key] : null; }