CakePHP 2.x で counterCache を使用して 2 つのフィールドを更新したいと考えています。私はこのコードを試しました:
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)
)
);
..しかし、最後のフィールドのみを更新します。