i use this variable to find the comments that related with articles..
$comment = $this->Article->Comment->findAllById($id);
i get errors when i added conditons like this..
$comment = $this->Article->Comment->findAllById($id,array('conditions' => array('Comment.status' => 1)));
i see this error>>
Warning (512): SQL Error: 1054: Unknown column 'Comment.' in 'field list' [CORE\cake\libs\model\datasources\dbo_source.php, line 684]
Query: SELECT DISTINCT `Comment`.`` FROM `comments` AS `Comment` LEFT JOIN `articles` AS `Article` ON (`Comment`.`article_id` = `Article`.`id`) WHERE `Comment`.`id` = 15
Take a look at the manual for the
findAllBy<field_name>()method.You’ll notice the second parameter is an array of
fields.I would recommend using Cake’s standard find method, something like: