Reputation: 1067
I think FuelPHP doesn't support this feature, but I would like to know the best way to do it....
I have 3 SQL tables: users
, modules
, modules_users
. an user has many modules, and a module may have many users (who follow it). In modules_users
, there's the actual_state
of the module for this user.
modules_users
has these fields:
- id
- user_id
- module_id
- actual_state
- previous_state
- updated_at
I need two ORM Models: Model_User
and Model_Modules
. I'd like to have access of related objects like this:
$actual_state = Model_User::find($id_user)->modules[$id_module]->actual_state; // from the table `modules_users`
$label = Model_User::find($id_user)->modules[$id_module]->label; // from the table `modules`
// and so on...
How could I do that?
Upvotes: 1
Views: 313
Reputation: 862
The best way would be to create an extra model that represents your through table (modules_users
) and then you would be able to easily access the extra property in your through table.
Upvotes: 1