Fixed yii\db\ActiveRecord::with() unable to use relation defined via attached behavior in case asArray is enabled

This commit is contained in:
Klimov Paul
2018-01-23 12:46:56 +02:00
parent 77bdcda5c5
commit b9cbc56330
3 changed files with 12 additions and 1 deletions

View File

@@ -162,7 +162,9 @@ trait ActiveQueryTrait
{
$primaryModel = reset($models);
if (!$primaryModel instanceof ActiveRecordInterface) {
$primaryModel = new $this->modelClass();
/* @var $modelClass ActiveRecordInterface */
$modelClass = $this->modelClass;
$primaryModel = $modelClass::instance();
}
$relations = $this->normalizeRelations($primaryModel, $with);
/* @var $relation ActiveQuery */