Hi,
We recently experienced an issue while using rules for updating order statuses reacting to the event "After updating an existing commerce order", our generic entity update hooks weren't fired properly.
After a lot of debugging, we found out that having those hooks fired after Rules could lead to issues (See the quote below and the issue described here #1211946: Invoking entity_save on hook_entity_insert() might cause troubles).
I assume the invoke method of DrupalCommerceEntityController hasn't been updated after the fix, and I think Commerce has to copy that change (http://drupalcode.org/project/entity.git/blobdiff/0e5ae63f144be44b00f2fe...).
To avoid any troubles with invoking entity_save() on hook_entity_insert() we have to make sure Rules operates last - else modules' update hooks might be invoked before their insert hooks.
For that Rules has already a rather high weight, however if modules implement the generic entity hooks they are currently still operating after Rules - as they come after the entity-type specific hooks. To fix, we need to use the generic entity hooks too for invoking rules events.
Entity type providing modules should just invoke the rules-event last. For the entity API we can fix that generally.
Patch following.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | commerce-fix-commerce-controller-invoke-2139037-1.patch | 1.09 KB | jsacksick |
Comments
Comment #1
jsacksick commentedComment #2
rszrama commentedThanks, Jonathan. Committed!
Comment #5
rszrama commented