Download & Extend

Invoking entity_save on hook_entity_insert() might cause troubles

Project:Rules
Version:7.x-2.x-dev
Component:Rules Core
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

Comments

#1

Component:Rules Core» Rules Engine
Status:active» needs review

Attached are patch for Rules + the Entity API.

AttachmentSizeStatusTest resultOperations
rules_entity_events.patch5.82 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch rules_entity_events.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details
rules_entity_events.patch5.82 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch rules_entity_events_0.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details
entity_rules_events.patch1.05 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_rules_events.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details

#2

added a comment explaining why do it that way + including a pointer to this issue. Updated rules patch attached.

AttachmentSizeStatusTest resultOperations
rules_entity_events.patch5.98 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch rules_entity_events_1.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details

#3

some more docu fixes spotted by klausi in real-time.

AttachmentSizeStatusTest resultOperations
rules_entity_events.patch5.98 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch rules_entity_events_2.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details

#4

Status:needs review» reviewed & tested by the community

Ack

#5

Status:reviewed & tested by the community» fixed

and committed, thx. :)

#6

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#7

Component:Rules Engine» Rules Core

I seem to have the same problem with webforms which does not seem to be an entity (inserting,not updating).
Is there another workaround I could develop / try?
For more information, please have a look at
this ticket

nobody click here