
I created several plugins and registered them with the Plugin Registration Tool. Some of them are associated to the same CRUD operation and primary entity.
It's not clear to me how should I set the Execution Order and the Event Pipeline Stage of Execution: should I set different values for the multiple plugins associated to the same CRUD method and entity?
For example, I have a plugin called CheckFields, it ensures that the required fields are not null. I registered it by setting "Movie" as Primary Entity, "Create" as Message, "1" as Execution Order and "PreValidation" as Event Pipeline Stage of Execution.
I have another plugin called "IncrementCode", it assigns a default code to new records. It's associated to the entity movie too and it's triggered by the CREATE operation too, so the values for Message" and Primary Entity are the same.
To avoid conflicts, should I assign different values for the Execution Order and/or the Event Pipeline Stage of Execution? And why?
If you need them to both run in the PreValidation stage then its ok to keep them there.
The execution order is the one to change here, 1 = first one to run, 2 = second, etc.
I think the better question is, if they are on the same event would it make sense to it to be 1 plugin with both actions taking place? IE: 1 plugin step registered firing and inside the code calling 2 different methods to complete your process.