Are you sure you want to find all Comments based on a Category?
Wouldn't it make more sense to find Comments based on Article (through
Articles based on Category)?

Anyway, you should be able to do (from CommentsController):

$this->Comment->Article->Category->find(
        'all',
        'array(
                'conditions' => array(
                        'Category.public' => 1
                ),
                'contain' => array(
                        'Article' => array(
                                'fields' => array('Article.id')
                        ),
                        'Comment'
                )
        )
);

On Sun, Jul 19, 2009 at 11:37 AM, eXistent<pirkl.lu...@gmail.com> wrote:
>
> Hi,
> I have a Comment, Article, Category models. Category has many articles
> and articles mas many comments. And category have boolean atribut
> public. I want to find all comments (with limit 10) whitch belongs to
> articles witch belongs to category with public = true. I don't know
> how to tell cake this things.
> $this->Comment->find('all',array('conditions'=>array
> ('Category.public'=>1)) don't work.
> Many thanks for all solutions.
> >
>

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