-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
relations defined with 'through' are not supported yet #14
Comments
i don't use |
Yes, it is. |
I'm developing the support for 'through' relations but I wonder how to pass the data to the behaviour. eg considering the scheme at http://www.yiiframework.com/doc/guide/1.1/en/database.arr#relational-query-with-through and the scenario in which a group is saved with its users and their roles. class Group extends CActiveRecord
{
...
public function relations()
{
return array(
'roles'=>array(self::HAS_MANY,'Role','group_id'),
'users'=>array(
self::HAS_MANY,'User',array('user_id'=>'id'),'through'=>'roles'
),
...
);
}
} When Group is saved should it have data in eg : $this->roles=array(
array('user_id' => $user_id1, 'name' => $name1),
array('user_id' => $user_id2, 'name' => $name2),
...
);
// versus :
$this->users=array(
array('user_id' => $user_id1, 'name' => $name1),
array('user_id' => $user_id1, 'name' => $name1),
...
); I think that the second option make more sense : in many situations "roles" is just a association table with additional fields. What do you think ? Maybe you have other ideas ? |
Any news on this? @Arnaud-F Did you finish your development and have anything to share? |
Here is some basic logic for saving has many relations with through vs without: https://github.com/neam/yii-relations-ui-core/blob/8ae18ab86f44d5a267d67b1ce4b260386466e8bb/behaviors/HasManyHandsontableInputBehavior.php#L159-L165 |
try adding support for it:
http://www.yiiframework.com/doc/guide/1.1/en/database.arr#relational-query-with-through
The text was updated successfully, but these errors were encountered: