fruit / sfCacheTaggingPlugin

The sfCacheTaggingPlugin is a Symfony plugin to store caches associated with unique tags to keep cache content up-to-date based by incrementing tags version
http://www.symfony-project.org/plugins/sfCacheTaggingPlugin
MIT License
15 stars 1 forks source link

Support the build-in behavior NestedSet #14

Closed fruit closed 13 years ago

fruit commented 13 years ago

Check for bugs, problems, errors when model has NestedSet behavior with plugin's behavior Cachetaggable.

  MyModel:
    actAs:
      Cachetaggable: ~
      NestedSet: ~
mcnilz commented 13 years ago

when using Cachetagable and NestedSet (from Doctrine) on the same Model, the NestedSet functions like moveAsNextSiblingOf do not work right. Using these function will not update the "level" column anymore...

I digged in the code and found the part which is causing the problem... In lib/vender/Doctrine/Template/Listener/Cachetaggable.php public function preDqlUpdate (Doctrine_Event $event) I had to change:

foreach ($selectQuery->execute() as $object)
{
  $tags[$object->obtainTagName()] = $updateVersion;
}

to

foreach ($selectQuery->fetchArray() as $object)
{
  $tags[$table->getClassnameToReturn() . ':' . $object['id']] = $updateVersion;
}
this prevents fetching objects from the DB with old values causing the conflict.            
fruit commented 13 years ago

@mcnilz, could you check d2fcd030370b2edba632d34b82f2f34dde755727 (v4.1.0) fixes your problem or not.

./symfony plugin:upgrade sfCacheTaggingPlugin
mcnilz commented 13 years ago

works :) good work.