Re: Best way to setup my comments system
I think you could also use behaviors - put all the common functions into the behavior and then set each of the model classes to behave. :) See more http://book.cakephp.org/view/88/Behaviors On Jun 21, 11:47 pm, Miles J mileswjohn...@gmail.com wrote: I thought of an idea if I use multiple tables. I can create my base model class of Comment. And then I can have the other tables extend that class to inherit their functions and that should work. class CommentsArticle extends Comment {} --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Best way to setup my comments system
I'm using just one table: comments with fields: id, model, model_id... Post hasMany Comment conditions=array('Comment.model'='Post') --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Best way to setup my comments system
I thought of an idea if I use multiple tables. I can create my base model class of Comment. And then I can have the other tables extend that class to inherit their functions and that should work. class CommentsArticle extends Comment {} --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Best way to setup my comments system
I think three table will be better. It will be more clear and obvious if there are relationships between comment and article or comment and photo. Actually, the cost of read or write database is the same. On Sun, Jun 21, 2009 at 9:05 AM, Miles J mileswjohn...@gmail.com wrote: Currently on GameSync, I have a comment system that is implemented on users profiles, you can see it in action here. http://www.gamesync.com/user/gearvOsh/comments But right now, there are only comments for profiles, but I want to implement comments for photos and articles. The predicament is whether or not I should use 3 tables, or 1 table with a type column. comments comments_articles comments_photos Currently im leaning to using 1 table with an enum column type to determine. The problem is that im concerned that the ID max will be reached faster if you are combining all 3. Thoughts? -- Thanks Joshua --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Best way to setup my comments system
The only thing thats making me go against multiple tables, is I have to duplicate the comments model each time I add more. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---