Ignore unnecessary joinWiths
Currently, \yii\db\ActiveQuery allows you to join the same relations twice (or more) with joinWith. Because of that, the DBMS will complain as you are doing multiple joins on the same table.
I am wondering why this isnt fixed with a simple patch to
- https://github.com/yiisoft/yii2/blob/master/framework/db/ActiveQuery.php#L429
in which $joinWith gets the relations mapped by their relation $key. This prevents double insertions and those problematic and unnecessary exceptions when you are ensuring that a joinWith is executed.
How do you want to fix it? Joining the same table is fine. For example, if you need N levels of adjacent list at the same time.
by their $alias as these also have to be unique in the DBMS.
Yes. That may work.