Change record status: 
Project: 
Introduced in branch: 
8.x
Introduced in version: 
8.0.0-alpha14
Description: 

All entities in core are now classed objects, the helper function entity_extract_ids() is therefore no longer needed and has been removed.

EntityInterface::id(), EntityInterface::bundle() and EntityInterface::getRevisionId() can now be used instead. Additionally, it is also possible to use the EntityInterface::entityType() method instead of using an additional $entity_type argument.

7.x

function mymodule_add_file_usage($file, $entity_type, $entity) {
  list($id, ,) = entity_extract_ids($entity_type, $entity);
  file_usage_add($file, 'mymodule', $entity_type, $id);
}

8.x

function mymodule_add_file_usage(File $file, EntityInterface $entity) {
  file_usage_add($file, 'mymodule', $entity->entityType(), $entity->id());
}
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done

Comments

br4ve-traveler’s picture

EntityInterface::id() [...] EntityInterface::entityType()

The methods listed above no longer exist in EntityInterface. Nor do they link to anything. I believe the correct versions are EntityInterface::getOriginalId() and EntityInterface::getEntityType()