My challenge now is figuring out how to sort my $user->taskPermissions records first by client.name and then by task.name:
I would usually use a series of joins to accomplish this with SQL and join in the client and task records with the permissions record to add the entities and sort by them. I can’t find any documentation here or via searching the forums (I’ve spent hours digging).
All I can seem to do is add an ‘order’=>’’ parameter to sort by any of the task_permissions table fields, but it won’t let me sort of the task_permission relationships.
Any good way to accomplish this? Seems like something that should be fairly common.
What I want is for all of this to happen automatically when the relations entity is created. I would like to add an ‘order’ parameter to the relationship defined in the user class to sort the relevant permission records.
Keith, thanks for the insight. I’ve been doing a lot of digging and learning on yii this week, so I will check out scopes and see if that will help.
It seems like maybe I’m hoping for relationships to do too much for me that I would usually do with normal SQL, but I thought that was what yii was intended to help with!