diff --git a/core/modules/field/field.purge.inc b/core/modules/field/field.purge.inc index 519c6af274..49b5464ca1 100644 --- a/core/modules/field/field.purge.inc +++ b/core/modules/field/field.purge.inc @@ -82,18 +82,19 @@ function field_purge_batch($batch_size, $field_storage_uuid = NULL) { } $fields = entity_load_multiple_by_properties('field_config', $properties); - $info = \Drupal::entityManager()->getDefinitions(); + $entity_type_manager = \Drupal::entityTypeManager(); + $info = $entity_type_manager->getDefinitions(); foreach ($fields as $field) { $entity_type = $field->getTargetEntityTypeId(); // We cannot purge anything if the entity type is unknown (e.g. the // providing module was uninstalled). - // @todo Revisit after https://www.drupal.org/node/2080823. if (!isset($info[$entity_type])) { + \Drupal::logger('field')->warning("Cannot remove field @field_name because the entity type is unknown: %entity_type", ['@field_name' => $field->getName(), '%entity_type' => $entity_type]); continue; } - $count_purged = \Drupal::entityManager()->getStorage($entity_type)->purgeFieldData($field, $batch_size); + $count_purged = $entity_type_manager->getStorage($entity_type)->purgeFieldData($field, $batch_size); if ($count_purged < $batch_size || $count_purged == 0) { // No field data remains for the field, so we can remove it. field_purge_field($field);