tags:

views:

22

answers:

0

I use Articles Plugins and Comments Plugins. Articles use Comments Plugins .Comments plugin have CommentableBehavior to bindModel Articles please watch code:

http://gist.github.com/620472

This is error when i use $this->Comment->delete($id);. I cant delete comment.

Warning (512): SQL Error: 1052: Column 'id' in where clause is ambiguous [CORE/cake/libs/model/datasources/dbo_source.php, line 681]
Query: UPDATE `articles` AS `Article` LEFT JOIN `images` AS `Avatar` ON (`Avatar`.`model_id` = `Article`.`id` AND `Avatar`.`type` = 'hasOne' AND `Avatar`.`model` = 'Article') LEFT JOIN `articles_categories` [...] 

Warning (2): Cannot modify header information - headers already sent by (output started at /home/content/92/6713492/html/gohentai/cake/libs/debugger.php:673) [CORE/cake/libs/controller/controller.php, line 746]

if I remove below in Article Model

var $belongsTo = array(
    'ArticlesCategory' => array(
        'className' => 'Articles.ArticlesCategory',
        'foreignKey' => 'articles_category_id'
    ),
    'User'
);
var $hasOne = array(
    'Avatar' => array(
        'className' => 'Image',
        'foreignKey' => 'model_id',
        'conditions' => array('Avatar.type' => 'hasOne', 'Avatar.model' => 'Article'),
        'dependent' => true
    )
);

then it deleted. please help me