cwbit / cakephp-aggregate-cache

A Behavior plugin for CakePHP that extends the idea of counterCache and counterScope to more fields
8 stars 4 forks source link

Handle foreignId changes, updateCache on both old and new #8

Closed Indemnity83 closed 9 years ago

Indemnity83 commented 9 years ago

On update of a model, if the foreignId changed (IE, comment moved to different post) the aggregateCache would be updated on the new foreign model, but the cache would remain untouched on the old model, leaving the cache out of sync. This update looks for changes in the foreignId and if detected calls __updateCache on both old and new models, keeping everything in sync.