I have a set of rules that looks like this:
- (rule) When flag A is set, do this:
- (action) set field X on flagged content
- (action) save flagged content
- (action) set flag B on flagged content
- (rule) When flag B is set, do this:
- Create new node
- (action) copy field X on flagged content to field Y in the new node
The problem is that the second rule does not see the new value of field X set in the first rule. It seems that this is caused by the fetch_content()
method in flag_flag
which caches the node too eagerly. Adding a "load content" action to the second rule which loads a node based on the flagged content's node ID (effectively reloading it) helps.
This is a problem because it introduces tight coupling between these rules (reloading the node in the first rule and flagging the reloaded node there didn't help!); the second rule needs to know it might be triggered as a result of executing the first rule (it can also be executed manually in the site I'm using this in).
Comments
Comment #1
quicksketchApologies for the lack of updates in this issue; I don't regularly participate in any of the issues that involve the Rules integration in Flag. I'm not sure if such a Rule exists, but it sounds like you need a rule that flushes the $node cache after "(action) set field X on flagged content". There may even be a simple Rule for "save node" that would do the job.
In any case, I think this is a general issue with Rules rather than Flag (since you'd have the issue with any updates to the node), and likely a support request.
Comment #2
quicksketchApologies above for my explanation, as I'm almost positive I mixed up "Rule" with "Action" in my terminology.
Comment #3
mitchell CreditAttribution: mitchell commentedtry https://drupal.org/project/cache_actions
Comment #4
Peter Bex CreditAttribution: Peter Bex commentedThat's a different sort of cache
Comment #6
Peter Bex CreditAttribution: Peter Bex commentedwait, what? This issue isn't fixed!
Comment #7
TR CreditAttribution: TR commented