You are here

protected function EntityShareEntityExport::unsetEntityIds in Entity Share 7

Clear entity ids.

Parameters

object $obj: Entity or sub entity to unset ids.

Throws

Exception In case of invalid entity.

1 call to EntityShareEntityExport::unsetEntityIds()
EntityShareEntityExport::contentFieldWalk in includes/entity_share.entity.export.inc
Walk though the entity to load dependencies and prepare it for the export.

File

includes/entity_share.entity.export.inc, line 108
Class for handling Entity Export.

Class

EntityShareEntityExport
Manage general entity export.

Code

protected function unsetEntityIds($obj) {
  if (!isset($obj->entity_type)) {
    throw new Exception('Invalid entity');
  }

  // Clear ids/vids.
  $info = entity_get_info($obj->entity_type);
  $obj->{$info['entity keys']['id']} = NULL;
  if (isset($obj->{$info['entity keys']['revision']})) {
    $obj->{$info['entity keys']['revision']} = NULL;
  }
}