If you want a simple CakePHP only solution:
Am Montag, 15. März 2010 19:16:56 UTC+1 schrieb Brenda:
-- http://www.dereuromark.de/2013/10/29/resetbehavior-and-hazardablebehavior/
you simply create a shell command "counts" or sth
and add those 2 lines to re-save all records in a loop
$this->Post->Behaviors->load('Tools.Reset', array('fields' => array(...)));
$this->Post->resetRecords();
the countercache should update itself - done :)
Am Montag, 15. März 2010 19:16:56 UTC+1 schrieb Brenda:
I'm upgrading an existing model to include counters for some of the
hasMany relationships. They all start out as zero, even though there
are many hasMany records; each record gets updated once a save/delete
occurs.Is there any way to tell Cake to go through and update all the
counters, so I can get correct initial values? Or should I just write
a SQL query to do it?thanks...
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment