I have two tables, Table A and Table B.
Now table A has A.id and B has B.id whereby B.id is the foreign key to link with A.id
Now my problem is, A has A.extraid that “HAS” many rows in B wherein the column name is B.notsamextraid. In other words, the values of B.notsamextraid matches the values of A.extraid
What should I do in order to have Yii match these two columns wherein they both have different names ?
(I am not authorize to alter the name of B.notsamextraid into B.extraid)
The Yii documentation says DO define foreign-key relationships in the database schema.
Can you try out the following tables? Yii should be able to pick up both foreign keys:
Edit: To find out if there are already foreign keys between two tables, you can use the following query. It’s not the prettiest query on the planet, but then there is copy and paste 🙂