Yes I try it. Because model category don't know model user i modify it
to:
this->Comment->Article->Category->find(
'all',
array(
'conditions' => array(
'Category.public' => 1
),
'contain' => array(
There's nothing in that query specifying that the Category should be
public. Anyway, did you try the statement I posted? If you need User
as well, change to:
$this->Comment->Article->Category->find(
'all',
'array(
'conditions' => array(
'Categor
I know about that but I wonder if it can be done otherwise. The Cake
way with find method is more beautiful :-)
On 20 čnc, 12:26, jeff wrote:
> use
>
> $this->modelname->query(" SQL STAEMENT HERE ");
>
> OR
>
> use this link for further study
>
> http://book.cakephp.org/view/456/query
>
>
>
> On
use
$this->modelname->query(" SQL STAEMENT HERE ");
OR
use this link for further study
http://book.cakephp.org/view/456/query
On Mon, Jul 20, 2009 at 3:53 PM, eXistent wrote:
>
> I need it for report of new comments, but only from articles inside
> public category.
> In SQL way it looks lik
I need it for report of new comments, but only from articles inside
public category.
In SQL way it looks like this:
SELECT * FROM
comments AS comment
LEFT JOIN articles AS article ON comment.article_id=article.id
LEFT JOIN categories AS category ON article.category_id=category.id
LEFT JOIN users
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(
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 th