there are already several different counterCache solutions available one in the core see the cookbook or http://stackoverflow.com/questions/1351823/countercache-in-cake-php
and several als plugins etc depends on what exactly you need http://bakery.cakephp.org/articles/danaki/2009/05/29/counter-cache-behavior-for-habtm-relations http://bakery.cakephp.org/articles/dericknwq/2007/05/02/countercache-or-counter_cache-behavior http://www.neilcrookes.com/2010/01/09/cakephp-treecountercachebehavior-plugin/ and probably some more On 6 Jul., 17:46, Jeremy Burns | Class Outfit <[email protected]> wrote: > In my experience you need to do it with a simple SQL query at the db level. I > am not aware of any Cake magic. If it's a continuous problem worthy of some > dev time you could write a simple behaviour to do it. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 6 Jul 2011, at 16:43, wiseguysonly wrote: > > > > > > > > > One of my early CakePHP sites has come back to haunt me. I need to add > > a counterCache to a pre-existing hasMany relationship. > > > Does there exist a method to set up the counterCache with current > > counts field once I have have created it? > > > Thanks in advance, > > > Tim > > > -- > > Our newest site for the community: CakePHP Video > > Tutorialshttp://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > [email protected] For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
