1
我想在CakePHP 2.x中使用counterCache更新兩個字段。我試過這個代碼:如何在表cakephp 2中使用counterCache更新兩個字段?
public $belongsTo = array(
'Table2' => array(
'className' => 'Table2',
'counterCache' => 'downvote_count',
'counterScope' => array('Table2.id' => 0)
),
'Table2' => array(
'className' => 'Table2',
'counterCache' => 'upvote_count',
'counterScope' => array('Table2.id' => 2)
)
);
..但它只更新最後一個字段。