Both ‘event’ and ‘student_user’ are BELONGS_TO relations. ‘student_username’ is a public variable defined at the beginning of my model (and set as safe in my rules). I’ve been trying use the following in my CGridView widget columns:
Thank you SO much for this post! You just saved me hours of frustration. It is amazing how simple that nested "with" statement works. One thing that had me confused is that I was trying to do the equivalent of
and it kept giving me the error “Unknown column ‘event.student_user.username’ in where clause”. I still think it is a bit strange that you just use student_user.username. I imagine this is standard convention for JOIN queries. I’m just not that familiar with them.
Once again, I amazed at how powerful and awesome Yii is.