Skip to content
Snippets Groups Projects
Commit fe1f50fc authored by Daniel Wehner's avatar Daniel Wehner
Browse files

Make the module compatible with php 5.5

parent c88386da
No related branches found
No related tags found
No related merge requests found
...@@ -51,13 +51,15 @@ class BundlePluginUninstallValidator implements ModuleUninstallValidatorInterfac ...@@ -51,13 +51,15 @@ class BundlePluginUninstallValidator implements ModuleUninstallValidatorInterfac
}); });
if (!empty($bundles_filtered_by_module)) { if (!empty($bundles_filtered_by_module)) {
$bundles_with_content = array_filter($bundles_filtered_by_module, function ($bundle_info, $bundle_id) use ($entity_type) { $bundle_keys_with_content = array_filter(array_keys($bundles_filtered_by_module), function ($bundle) use ($entity_type) {
$result = $this->entityTypeManager->getStorage($entity_type->id())->getQuery() $result = $this->entityTypeManager->getStorage($entity_type->id())->getQuery()
->condition($entity_type->getKey('bundle'), $bundle_id) ->condition($entity_type->getKey('bundle'), $bundle)
->range(0, 1) ->range(0, 1)
->execute(); ->execute();
return !empty($result); return !empty($result);
}, ARRAY_FILTER_USE_BOTH); });
$bundles_with_content = array_intersect_key($bundles_filtered_by_module, array_flip($bundle_keys_with_content));
foreach ($bundles_with_content as $bundle) { foreach ($bundles_with_content as $bundle) {
$reasons[] = $this->t('There is data for the bundle @bundle on the entity type @entity_type. Please remove all content before uninstalling the module.', [ $reasons[] = $this->t('There is data for the bundle @bundle on the entity type @entity_type. Please remove all content before uninstalling the module.', [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment