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

@ -1600,5 +1600,13 @@ abstract class ActiveRecordTest extends DatabaseTestCase
$this->assertInstanceOf(OrderItemWithConstructor::className(), $item);
$this->assertEquals(1, $item->item_id);
// @see https://github.com/yiisoft/yii2/issues/15540
$orders = OrderWithConstructor::find()
->with(['customer.profile', 'orderItems'])
->orderBy('id')
->asArray(true)
->all();
$this->assertCount(3, $orders);
}
}