Hi all, I'm building a content managed site with several slightly different types of record, but all of which feature a common set of fields e.g. title, summary, description, start_date, end_date, notes, etc. Some types of record have one or two extra fields, e.g. location, price, etc.
I've always wondered what's the best way of approaching this with cake, or indeed any framework? To have a single database table, model, controller etc with a field and logic indicating the record type? Or to implement each record type with a different table, model, controller etc? I guess the first option of one model involves less repetition, but how would you handle different record types having a slightly different validation rules based on the fact that sopme have extra fields that need to be validated? Presumably you'd need to use a model beforeValidate() function instead of the standard validation array? The second option would seem to follow the MVC convention a little better and validation would be easier but seems to have more repetition. Looking at this in an object oriented way with classes you would I guess define a base class with the common characteristics and then extend / specialise this for other models. How does that work with cake? Thanks all, Alex --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
