Problem/Motivation
The auto_entitylabel_entity_insert function saves the entity and that is not allowed according to hook_entity_insert documentation https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
It breaks the hook_entity_insert and hook_entity_updates hooks for others as they now both fire in reverse order for other modules.
This hook runs once the entity has been stored. Note that hook implementations may not alter the stored entity data.
Steps to reproduce
Add hook_entity_insert and hook_entity_updates to your module and make sure you use auto_entity_label on this entity.
On entity insert hook_entity_insert and hook_entity_updates will both fire in reverse order which is wrong
Proposed resolution
Remove the save from hook_entity_insert
Remaining tasks
Remove the save from hook_entity_insert
User interface changes
API changes
Remove the save from hook_entity_insert
Data model changes
Issue fork auto_entitylabel-3367643
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
anybodySeems the whole auto_entitylabel_entity_insert() implementation makes no sense, then?
I don't really get the purpose anyway...
Comment #5
grevil commentedI get php errors when removing this.
#3076302: Set Label runs two times on node creation already heavily modifies the method, (including removing the save call) so I guess, we should simply get that merged already. And simply close this issue.
Comment #6
grevil commentedUpdate: the save call is still present in #3076302: Set Label runs two times on node creation, but just moved into a helper methdo, let's keep this open and wait that issue to get resolved, afterwards we can tackle the removal here.
POSTPONED on #3076302: Set Label runs two times on node creation.
Comment #7
dqd@grevel: agreed. +1