Through the development of Webrocket, I was always looking for an easier way to define custom content types - much like Drupal - so that any content on the site inherited the core values of my node type. I wasn't having so much luck until I came across a tutorial for Implementing Single Table Inheritance In CakePHP.
Now I am in love with this method! It's taken from RoR, and is not standard in CakePHP - but has been easy to implement. Basically, I now have 1 table for ALL content on the site, be it a page, post, image, event or anything else I decide to add.
My core table is called my 'leafs' table. Each leaf type is defined in it's own model, and by changing some of the core functions such as findALL() I am able to inherit the fields that I want for that content type. For example, a Page does not have start and end dates attached to it, but an Event does not have a byline. But by specifying what fields to use in the model, I can ignore the ones I don't need.
It also seems very expandable - if I want to add a new content type, or even add a new field type to existing models, all I need to add them to the database and include them in the model with minimal fuss.
The only cevat is that Bake does not currently support it, so if I want to create my new MVC for the content type, I have to do it manually. Hopefully this will be corrected in the future by adding an interactive way to create new models with only one main table.
Edit: Well they are cool, but it seems that CakePHP's paginate functionality doesn't like my custom findAll() function and likes to spit out warnings and errors. Due to deadlines, I'm going to have to abandon this line of enquiry - but not forever! Once I pass my current milestone, it'll be something I'll look at again - maybe even look at Class Table Inheritance as another option.
Blogged with Flock