I have two tables:
user and asset and there is user_asset table that makes many_many relation
Now I want to show only the assets related with logged-in user in CGridView (user_id comes from Yii::app()->user->id)
How to write a criteria that makes it possible?
I got it work, adding this inside the Model class’s search method:
… and inside CActiveDataProvider declaration:
Maybe not the best way but does what needed.
users_usersis sql table alias by Yii, I got a hint from error message 🙂