Hi all!
I’m new to Yii - so bear with me, please. Any suggestions and hints that lead me to the right direction are greatly appreciated…
My problem:
I have a TbGridView that’s filled with values from a query (ok, I know that’s obvious
Now, I need some values from a foreign table. The problem is, that the foreign table has fieldnames that are similar to the original table.
In SQL, I’d do something like this:
SELECT table1.*, table2.fieldname AS altered_fieldname FROM table1
LEFT JOIN table2 ON table1.foreign_id = table2.id
That’s pretty simple, isn’t it?
But: How the heck do I do this in Yii???
I found out about relations, but this always seems to join the whole foreign table, without the possibility to change fieldnames from the foreign table.
I also looked at criterias (which are another subject, since I need to be able to search that foreign field), but that’s quite confusing as to what a criteria actually does.
I’m used to write my own SQL-statements, so accessing the database with the yii-approach is quite confusing to me…
Thanks in advance for any help.