Hi guys,
Like a lot of you, I’m pretty new to Yii and I have a question.
I can make models, show records in cgridview and search the records even for 1to1 relations with other tables…
Now I need a good solution for A 1 to Many…
let’s say I have 3 tables…
Clients
Clientpropertyvalues
Clientpropertynames…
Clients
-id (pk)
-username
-password
-updated
-active
clientpropertynames
-id (pk)
-name
clientpropertyvalues
-id (pk)
-clientid (Fk -> clients.id)
-propertynameid(FK -> clientpropertnames.id)
-value
so for data we has
CLIENT
1 | user1_username | user1_password | 2012-11-17 … | 1
2 | user2_username | user2_password | 2012-11-17 … | 1
CLIENTPROPERTYNAMES
1 | name
2 | last name
3 | street
4 | nr
5 | city
6 | zip
7 | email
…
CLIENTPROPERTYVALUES
1 | 1 | 1 | Tom
2 | 1 | 2 | Peeters
3 | 1 | 3 | straatnaam
4 | 1 | 4 | 3
5 | 1 | 5 | Antwerpen
6 | 1 | 6 | 2000
7 | 2 | 1 | Tommy
8 | 2 | 2 | Seghers
9 | 2 | 3 | straatnaam
10 | 2 | 4 | 5
11 | 2 | 5 | Brussel
12 | 2 | 6 | 1000
how can I implement this in a Yii model so I can have a provider for the gridview to view and search in with data like this
id | username | password | active | name | lastname | street | …
1 | user1_username | user1_password | 1 | tom | peeters | straatnaam |
1 | user2_username | user2_password | 1 | tommy | seghers | straatnaam |
How do I create my model(s)
how can I get the data together for the gridview ?
and how can I implement the filter search
thanks for helping…