Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By Berdir on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Introduced in version:
8.0.0-alpha14
Issue links:
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
Comments
No longer accurate
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()