Over at #1340984: UUID support, a second call to hook_entity_presave() was introduced. I'm not sure if this was intentional or not. I'm seeing this extra hook breaking integration with the title module, since the first call properly sets the title field, while the second call resets it. I can patch title module if that's where the issue should be fixed, but thought I'd inquire here first to see if this was a simple mistake.

CommentFileSizeAuthor
#3 double_call_to-2098041-3.patch917 bytesalcroito
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jagilpe’s picture

Issue summary: View changes

Is there any update to this issue? We have a problem with the title translation of fieldable panels panes, and the only logical solution that we've found is to remove one of the hook_entity_presave calls, but we would like to know if there is a reason to call this hook twice, to be sure that it's safe to remove one.

alcroito’s picture

I've investigated the code in other entity modules to see whether any-one else invokes the 'entity_presave' hook twice, and that does not seem the case.
The only reason I think that the second call was added, was to re-execute uuid_entity_presave, so it regenerates the vuuid key, after the old vid was removed.
But I think that is erroneous and it is not necessary, if you look at node_save() it also first calls hook_entity_presave(), and afterwards unsets the vid key, without calling the hook a second time.

alcroito’s picture

Status: Active » Needs review
FileSize
917 bytes

Attaching a patch that removes the second invocation to hook_entity_presave().

DamienMcKenna’s picture

  • DamienMcKenna committed f55dd4a on 7.x-1.x authored by Placinta
    Issue #2098041 by Placinta: Don't call hook_entity_presave twice in one...
DamienMcKenna’s picture

Status: Needs review » Fixed

Committed. Thanks!

Status: Fixed » Closed (fixed)

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