Counter Cache behavior for HABTM relations

2009-07-30 Thread Luke

Hi

I have a HABTM Relationship and was using CounterCache, following the
below script:

http://bakery.cakephp.org/articles/view/counter-cache-behavior-for-habtm-relations


It worked well, till I decided that a user should be able to choose
more than 1 Category. Since than the CounterCache is not working
anymore, because it is complaining that the id I am looking for to
update is now an Array. (WHERE `subcategory_id` = (Array))

Does anyone knows the above script and maybe know how to get this to
work? It was a nice function and it would be great to work again.
Thanks a lot.

Luke




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Counter Cache behavior for HABTM relations

2009-07-30 Thread Luke

Hi,

I just found the solution myself I think, I added

 foreach ($this-foreignTableIDs[$assocData['className']] as $id)

into the updateCounters method and it now updates for every category.
Maybe this comes handy for someone.
It seem to work and I get no error message anymore.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---