yii2
yii2 copied to clipboard
Via joined
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ✔️ |
Breaks BC? | ❌ |
Fixed issues | #1429, #10174, #16606, #17166, #17558 |
This PR adds several functions to the \yii\db\ActiveQuery
class to support relations using 'inner join' to resolve the 'via' relation(s). This solves the problems described in the "fixed issues" list above and on the following websites:
https://stackoverflow.com/questions/27690401 https://stackoverflow.com/questions/69329769 https://forum.yiiframework.com/t/how-to-orderby-on-viatable-in-hasmany-model-relationship/80043 https://copyprogramming.com/howto/can-t-sort-hasmany-relationship-in-yii2
The new functions are:
viaJoined()
: Same as via()
but using inner join(s).
viaJoinedTable()
: Same as viaTable()
but using inner join.
viaJoinedTables()
: Supports multiple via tables using inner joins.
ToDo:
- [x] Unit tests
- [ ] PHP DocBlocks
- [ ] Documentation