On Mar 21, 8:07 pm, Hernan <[email protected]> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to