Blog

Possible update counterCache Function

I haven’t tested this yet. But it is a possible update counterCache function.   <code> function counterCheck( ) {   $counterTemplate = “UPDATE :atable AS :amodel SET :counter = ( SELECT COUNT(:model.id) FROM :table AS :model WHERE :model.:foreignkey = :amodel.id )”;   $updates = array();   $models = Configure::listObjects(‘model’) ;   foreach ($models as $model)…