Saturday, July 30, 2011

Many HABTM relations in a single joinTable ?

Hi,

I wonder if it's possible to get many HABTM relations working in a
single table ? For example I want my Products, Pages and News to be
paired as HABTM with my Images. So I have table named "images_items"
with a model named ImageItem and the table looks like this:

id - INT
item_id - INT
item_type - ENUM('product','page','new')
image_id - INT

So for example when data for Product is fetched, I need to make it get
the data from the images_items table BUT only the records where
item_type = 'product' and not 'page' or 'new'. Hope I made it clear :/

Anyone knows if this is possible through some of the HABTM array
definition keys ?

Any help will be appreciated. Thank you in advance

Best Regards,
Alex

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: