阅读背景:

在Yii2中的where条件下,多个连接的行为不同

来源:互联网 
$materials = Material::find()
    ->where(['in', 'Material.MaterialId', $value])
    ->joinWith(['objectName'])
    ->all();

$product = Product::find()
    ->where(['Product.productId' => $id, 'Product.ModelId' => $mid])
    ->joinWith(['product' => function ($query) {
        $query->joinWith([
            'objectName',
            'contents' => function ($query2) {
                $query2->joinWith(['material' => function ($query3) {
                    $query3->where(['in', 'Material.MaterialId', $value])
                        ->joinWith(['objectName']);
                }]);
            },
        ])
        ->all();
    }])
    ->one();
$materials = Material::find()
    ->where(['in'



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: