Thursday, April 28, 2011

Query with conditions in HABTM models

Hello,
I have a table posts related with table categories with de habtm table
posts_categories.

posts.id
categories.id
posts_categories.post_id
posts_categories.category_id

I'm trying to get all the records WITHOUT category (because I have
posts taken from RSS and not categorized yet).

My model Post has the habtm array, and it works fine (I get all the
posts with there categories when I find all).

My question is how could I get all the records in posts table that are
not included in related table. Any idea?

All my attempts (conditions, contain...) are wrong :(

Thank you very much!
David.

--
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: