Hi All, I'm having a bit of trouble figuring out how to set up my models & controllers with respect to my database. Here is a general overview of what I'm trying to accomplish.
I have 2 main tables: conditions & remedies. remedies can belong to several conditions, so i set up another table called remedies_to_conditions. (Not sure if that's the best way to do it...I saw an example like this online and it made sense) My question is, how do I set up the relations in the models? Can I use a $hasMany in my conditions model to point to remedies_to_conditions? If so, do I need a controller & model for remedies_to_conditions even though there is no actual view for this table? Basically, when my users view a condition, I would like a list of the remedies associated with that condition to show up. Thanks in advance for any suggestions. This is what the tables look like: CREATE TABLE `conditions` ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL, `description` text NOT NULL, `viewed` int(5) default '0', `created` datetime default NULL, `modified` datetime default NULL, PRIMARY KEY (`id`), KEY `conditions_name` (`name`) ) CREATE TABLE `remedies` ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL, `description` text NOT NULL, `viewed` int(11) default '0', `created` datetime default NULL, `modified` datetime default NULL, PRIMARY KEY (`id`), KEY `remedies_name` (`name`) ) CREATE TABLE `remedies_to_condtions` ( `remedy_id` int(11) NOT NULL, `condition_id` int(11) NOT NULL, PRIMARY KEY (`remedy_id`,`condition_id`) ) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
