Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Via joined #19805

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft

Via joined #19805

wants to merge 21 commits into from

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.

None yet

1 participant