Hello,
I'm new to CakePHP and PHP in general. I turned to the mailing list for help because I'm stuck and couldn't find what I need from searching the internet, so I hope you guys could help me out. [Sorry if this happens to turn out too easy. Like I said, I'm new to Cake and PHP in general, so be nice. ;) ]
I'm building an application that would connect serially to a device. As a user can opt to have different device configurations, I made a model named "settings" that have the following fields:
| id | port_direction | port_value | etc.
| 1 | 00 | 00 | .
| 2 | 01 | 02 | .
How do I map these rows to a column of another table containing the commands corresponding to the "settings" fields?
| id | command_name | command_code
| 1 | port_direction | 1201
| 2 | port_value | 1202
Updating each of the "settings" fields, requires accessing the corresponding element in the "commands" table. I can't really think of an association to connect the two tables (I don't think the "commands" table can really be classified as a model, but more of a simple list), as each "setting" would require using *all* elements of the commands table (hasOne and belongsTo is one-to-one, HATBM would create an extremely large table with repeating relationships).
What do you suggest I do to be able to access the "commands" table from the "settings" model?
Thanks in advance.
I'm new to CakePHP and PHP in general. I turned to the mailing list for help because I'm stuck and couldn't find what I need from searching the internet, so I hope you guys could help me out. [Sorry if this happens to turn out too easy. Like I said, I'm new to Cake and PHP in general, so be nice. ;) ]
I'm building an application that would connect serially to a device. As a user can opt to have different device configurations, I made a model named "settings" that have the following fields:
| id | port_direction | port_value | etc.
| 1 | 00 | 00 | .
| 2 | 01 | 02 | .
How do I map these rows to a column of another table containing the commands corresponding to the "settings" fields?
| id | command_name | command_code
| 1 | port_direction | 1201
| 2 | port_value | 1202
Updating each of the "settings" fields, requires accessing the corresponding element in the "commands" table. I can't really think of an association to connect the two tables (I don't think the "commands" table can really be classified as a model, but more of a simple list), as each "setting" would require using *all* elements of the commands table (hasOne and belongsTo is one-to-one, HATBM would create an extremely large table with repeating relationships).
What do you suggest I do to be able to access the "commands" table from the "settings" model?
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment