Fixes #14059: Removed unused AR instantiating for calling of static methods

This commit is contained in:
Dmitry Eliseev
2017-04-26 16:09:55 +03:00
committed by Alexander Makarov
parent 375ea7a847
commit d7fad8a555
3 changed files with 4 additions and 6 deletions

View File

@ -83,6 +83,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
--------------------------

View File

@ -276,9 +276,8 @@ class QueryBuilder extends \yii\db\QueryBuilder
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);
}

View File

@ -65,10 +65,8 @@ abstract class BaseActiveFixture extends DbFixture implements \IteratorAggregate
$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;
}