mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Fixed yii\db\ActiveRecord::with() unable to use relation defined via attached behavior in case asArray is enabled
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user