Is this supported? It doesn't seem to work, but I don't see a reason why not.

If I have a rule, let's say it reacts on event my_event, with a data comparison condition that some_var must be 1, and then it creates a Message entity of type message1.

But I want to create another Message, so I create a second event that reacts on my_event with some_var equal to 1, and this creates a Message entity of type message2.

What I found is that both events fire, but only one message is ever created. If I use the Debug module and add a debug action for the entity_created, then I see them both there. If I add debug messages to the entity creation functions of the Message module then I see them being called twice. When I look at the Rules debug log, it shows both rules firing and evaluating the action entity_create. So I can't see why it's only creating one of the entities. There are no errors.

The rules themselves are fine. If I delete either one of them, then the other one will always work. It's only when they both exist that only one of the messages is ever created. Maybe there's a race condition so although both entites are created in the code, only one ever gets saved to the database?

I can get it to work by using the same rule and giving it 2 actions of entity_create (and I have to change the name of the provided variable because it already exists). But why doesn't it work with two rules? Is this explicitly not supported, even though all the evidence shows that both rules are triggered and the actions are being run. I can even put a dpm() in the entity creation function of the Message class and see it being called twice, but it seems that only the first one is actually saved.

Comments

TR’s picture

Status: Active » Closed (outdated)

I have no idea what's happening here and you haven't given enough information to reproduce the problem. If this is still a problem with the current version of Rules, please export your rules and post them here along with a detailed description of how to reproduce the problem. Try to simplify the rules so they don't use any other modules - if this is a problem with Rules then you should be able to demonstrate it with core entities rather than having us install and configure some other entity-providing module.