You don't need contain, unless you want the post data too:
$this->Post->Subject->find("all", array(
"conditions"=>array(
"Subject.post_id"=>$post_id
)
);
If you do need the post data, brian's solution should work just fine.
On Apr 25, 5:21 am, brian <[email protected]> wrote:
> This doesn't work?
>
> $this->find(
> 'first',
> array(
> 'conditions' => array(
> 'Post.id' => $post_id
> ),
> 'contain' => array(
> 'Subject'
> )
> )
> );
>
> On Fri, Apr 24, 2009 at 11:30 PM, Dave Maharaj :: WidePixels.com
>
> <[email protected]> wrote:
> > Can someone help me with a contain using a HABTM relationship.
> > POSTS HABTM SUBJECTS
> > SUBJECTS
> > POSTS_SUBJECTS
>
> > I have Post HABTM SUBECTS
>
> > I just want to print out the array of SUBJECTS that the POST has.
>
> > I managed to get the rest of the contain for the other hasmany tables...just
> > cant get the HABTM
>
> > Thanks
>
> > Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---