Skip to content

cross-database join #20693

@andrtechno

Description

@andrtechno

Proposed new feature or change

ActiveQuery -> joinWith не поддерживает join разных баз (на одном сервере)

class A extends ActiveRecord
{
    public static function getDb()
    {
        return Yii::$app->get('main');
    }

    public function getB(): \yii\db\ActiveQuery
    {
        return $this->hasOne(B::class, ['id' => 'b_id']);
    }
}


class B extends ActiveRecord
{
    public static function getDb()
    {
        return Yii::$app->get('second');
    }
}

Example

$q = A::find()->joinWith(['b'])->one();

было бы не плохо сделать чтобы поддерживало

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions