Two foreign keys to same target table

Hello

I seem to get to a limit of Yii2’s Crud but perhaps I’m wrong !?

In my table xxx I have to fields : customer and paymentcustomer

I defined 2 foreign keys for this 2 fields - all the 2 pointing to customer table

The model and crud generator that I use generate the model, the controller and the views

But nothing is working :

for example in the case of creation of a record in table xxx I get :

Is there a way to generate my files without getting this kind of error ?

ok I found :


...->from(Customer::tableName() . 'c2');

This works but I would like to understand more what I’m doing :

How does yii2 name the alias by default ? c1 ? I don’t know but seems not good !

I’m modifying model generator to get it work so I need to generate this alias automatically if there are multiple foreign keys on one target table