ActiveRecord where and order on via-table

前端 未结 8 750
南旧
南旧 2020-12-16 12:22

I have three database table:

product (id, name)

product_has_adv (product,advantage,sort,important)

advantage (id, text)

In ProductModel I def

8条回答
  •  余生分开走
    2020-12-16 13:06

    Just for reference https://github.com/yiisoft/yii2/issues/10174 It's near impossible to ORDER BY viaTable() columns. For Yii 2.0.7 it returns set of ID's from viaTable() query, and final/top query IN() clause ignores the order.

提交回复
热议问题