You have three options: - put generic code in app_model.php - use model inheritance, eg. class MyModel extends MyBaseModel, class MyBaseModel extends AppModel - write a model behaviour (not unlike multiple inheritance)
Cheers, Adam On Mar 10, 4:04 pm, sleepy1038 <[EMAIL PROTECTED]> wrote: > In my application, I will have the same problem if I put the bulk of > the code in the models. I have as many models as I do controllers. How > should I handle this? > > Thanks > > On Mar 9, 10:31 pm, mbavio <[EMAIL PROTECTED]> wrote: > > > The essential Fat Models, Skinny Controllers: > > > "Write big and long models, and short controllers" > > > DRY itself. > > > Cheers, > > Martin B > > > On Mar 9, 4:52 pm, sleepy1038 <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I've recently implemented a content management system using Cake, and > > > am running into a design issue. I have many different types of posts > > > (articles, books, etc.). All these posts must be associated to tags. I > > > implemented a general posts table, and associated the tags to this. I > > > then implemented each type of post as belonging to a content post. > > > > The problem is, I now have many controllers. Each post type has its > > > own controller, although aside from differing fields they pretty much > > > have the same controller logic. The only thing that really differs in > > > each controller code is the name of the controller instance. Whenever > > > I need to make an update, I have to essentially copy and paste into 10 > > > different controllers. > > > > My questions is, how do I consolidate this logic into one location. I > > > thought about using a component, put b/c Cake uses lazy loading I > > > don't believe the model classes are available in a component. Am I > > > wrong about this? Is there a way around this? Also, is there any way > > > to consolidate the many views associated with the controllers? Any > > > help would be greatly appreciated. > > > > Thank You --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
