Welcome Guest, Not a member yet? Register   Sign In
Swith to object oriented programming
#11

Ok, I have understood that the model gives automatic database connection and some basic methods such as find(). So far so good. Now I have a question… I want to join my Recipes table with a secondary table. After getting the recipeModel, I have a problem because the join creates two “id” fields. Manually writing the queries I can give an alias, such as 't1' and 't2' to the tables, so that I can say “orderby('t1.id'). When getting the table from the recipeModel, how can I set the alias or make it clear how to differentiate the main table from the secondary table?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB