I have a model of person and group_membership
If I want to allow a user to see the groups in the CGridView of the Admin page (or page like admin) for Person
any suggestions on how to accomplish this?
ID, Person, Groups
1, Bob Miller, (A, B, C, F)
2, Mike Smith, (C, D, F)
is there a widget that can be included in a CGridView column that would go out and query the list of groups for the Person?
Another concern I have is how do I allow the user to search for Persons in Group "C and D"?
Have you setup the relations among the models?
Person HAS_MANY Group_Membership
Group_Membership BELONGS_TO Person
Group HAS_MANY Group_Membership
Group_Membership BELONGS_TO Group
Thank you softark.
I have defined the relations as such.
I was just curious if there was a widget to deal with a column referencing a table…( I guess )
I believe it is possible to define a column as a object which is in itself a list. I have done it in the Oracle
world. I just don’t know how to do it in mysql.
I was thinking about this last night at 3am, it seems there could be a list/array widget that could display
and handle searching.
Doing this as a simple string of ‘A, B, C, F’ in a varchar or text column is fine until you want to search it.
Then a user entering "A" will get a correct result
but a user enter ‘A, C, B’ will not find a row with ‘A, B, C’ when they in fact should.
So you don’t have any critical problem displaying related items. Am I right?
But, yeah, searching by this kind of relation is a headache. I’m afraid there’s no easy solution for it.
I recently wrote a wiki about searching by HAS_MANY relation. Please take a look at it.
I think you can adopt the concept to your case just with a slight modification.
Thank you my friend ! Very interesting!
I have many years in RDBMS design mostly Oracle, M:M has always been difficult…