I have two tables, ‘home’ and ‘tabs’ with a many-to-many relation. I also have a join table ‘home_tabs’ which is just the keys of each in addition to a displayorder column.
However, my problem is that field name is ambiguous (other tables use that same column name) and when I combine this with a larger query it throws an error. Is there a way to manually set the alias for the join table so I can use that in my relation? I looked at what Yii is doing when it creates the query and it is giving it the name ‘tabs_tabs’ so if I hardcode that in it works but I’m not positive it will always be that so I’d rather explicitly set the name or call it on the fly when the code executes.
I’ve tried setting the alias in the relation but that seems to apply it to the Tabs model, not the actual join table model. Anyone have any ideas or is this some obvious thing I’m just missing? Thank you.
Thank you for the reply. I think I see what you mean. Here is how I’ve updated everything, let me know if this makes sense (it appears to be working but I have a very limited data set for testing right now)