I have tables:
users {id, name} projects {id, name} roles {id, name} projects_users {id, user_id, project_id, role_id}
I have models:
project { has many users through projects_users } user { has many projects through projects_users }
Question: How i get user roles for one project? Or maybe i have to reconstruct my tables?
Code:
$project = ORM::factory('project', $id); $users = $project->users->find_all(); foreach ($users as $u) { $roles = $u-> .... How to get all roles for this user and for this project? }