public function getOrders() { return $this->hasMany(CustomerOrder::className(), ['customer_id' => 'id']); }
/** * @see https://github.com/yiisoft/yii2/issues/5411 * * @depends testFindEager */ public function testFindEagerHasManyByArrayKey() { $order = CustomerOrder::find()->where(['number' => 1])->with('items')->one(); $this->assertNotEmpty($order->items); }