Thanks for the quick reply!
It does indeed work that way so thanks for that! However, I forgot to
tell a part of the story.

Those tags have other HATBM relationships as well to a 'users' table.
Many Users can have many tags. So when I execute the query, all the
users relationships come as well which is not cool. Is there any way
to tell which HATBM relationship to show and which not?

Thanks!

On Mar 21, 11:19 pm, mscdex <msc...@gmail.com> wrote:
> On Mar 21, 8:07 pm, Hernan <hernancalabr...@gmail.com> wrote:
>
> > Then, in the Tag model, I have a function that should bring the all
> > contents for that tag.
> > How do I do that? is it possible using find or do I need to make a
> > custom query?
>
> Assuming you have your models and everything set up correctly, you
> should be able to use the model's find method to get what you want.
>
> > If I do a find on the Content model, I can bring all the contents but
> > I don't know how to do a contidion for "Tag.id"=>1
>
> Try something like: $tag = $this->Tag->find('first', array
> ('conditions' => array('Tag.id' => 1), 'recursive' => 0));
> Then $tag should contain information about the tag and its associated
> contents. You may wish to specify a 'fields' sub-array also if you do
> not want to pull in all information from each model.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to