Tuesday, February 2, 2010

Related lists, polymorphic habtm? (fao: AD7six ;))

Hi bakers,

Been mulling this over and haven't hit on the ideal solution yet, so
thought I'd try and put it down to get some outside ideas.

I'm trying to find a flexible way to associate a record in one table
with many other records from other tables, but contained within a
single list. Eg, say you're building a CMS and the home page has a
large features 'carousel', or on a product page you want a 'if you
like this you might like' list to point people into other areas of the
site. An item in either of those could be a Page, Event, Article,
Post, Product - basically any type of content in your system.

I'm keen to avoid having a features and feature_items table, as

General things I'm after are:

- store this info in a single table (composite, I think) table
- be able to override certain fields such as name on a per list item
basis, or use the values from the linked data
- be able to retrieve each list in a single set of data, allowing a
custom order to be used
- data should be retrievable using a standard find with contain

I think what I want is a habtm that can connect to multiple models
with some additional fields in the join table, but I'm not sure that's
feasible, but hope it is.

Grateful for any pointers.

Cheers,

Jon

--
jon bennett - www.jben.net - blog.jben.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: