I want to update two fields using counterCache in CakePHP 2.x. I tried this code:
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)
)
);
.. but it only updates last field.
1 Answer