I've looked through the archives and found threads discussing things similar to what I'm going to ask, but not exactly.
I'm working on a task manager project. I've got three models (really more but one is very similar to many others): Task, Category, and Assignee. I have 4 DB tables -- task, categories, assignees, and assignees_tasks. In my tasks DB table, I have a PK of id and a foreign key of category_id. There is the foreign key for the categories table because I only need to link to one category. The categories table is static, not going to change. There is no foreign key for the assignees table because I want to be able to have more than one assignee for a task, hence the assignees_tasks table. It simply contains two fields -- assignee_id and task_id. (Please correct me if this is the wrong way to do it.) The assignees table is also not going to change. So, I've been reading about hasOne and belongsTo and hasAndBelongsToMany. As far as I can tell, the association for the Task model is HABTM to the Assignee Model. Is this correct? Does this association need to go both ways? I'm still unsure what to do with the association from Task to Category. Should this be Category belongsTo Task? If so, do I also need to do Task hasOne Category? -- -- Table structure for table `assignees` -- CREATE TABLE `assignees` ( `id` bigint(20) NOT NULL auto_increment, `userName` text NOT NULL, `password` text NOT NULL, `firstName` text NOT NULL, `lastName` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `assignees_tasks` -- CREATE TABLE `assignees_tasks` ( `assignee_id` bigint(20) NOT NULL, `task_id` bigint(20) NOT NULL, PRIMARY KEY (`assignee_id`,`task_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `categories` -- CREATE TABLE `categories` ( `id` bigint(20) NOT NULL auto_increment, `category` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `tasks` -- CREATE TABLE `tasks` ( `id` bigint(20) NOT NULL auto_increment, `subject` text NOT NULL, `description` text NOT NULL, `notes` text NOT NULL, `created` date NOT NULL, `modified` date NOT NULL, `due` date NOT NULL, `estimated` date NOT NULL, `percentage` int(11) NOT NULL, `category_id` bigint(20) NOT NULL PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---