Skip to content

Conversation

rhertogh
Copy link
Contributor

@rhertogh rhertogh commented Apr 10, 2023

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:

  • Unit tests
  • PHP DocBlocks
  • Documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant