Commit f0d90253 authored by ao2's avatar ao2 Committed by andypost

Issue #2827140 by Syndz, ao2: Simple refactoring of drush dcer

parent e4e75b9f
...@@ -88,14 +88,14 @@ function drush_default_content_export_references($entity_type_id, $entity_id = N ...@@ -88,14 +88,14 @@ function drush_default_content_export_references($entity_type_id, $entity_id = N
$manager = \Drupal::service('default_content.manager'); $manager = \Drupal::service('default_content.manager');
$folder = drush_get_option('folder', '.'); $folder = drush_get_option('folder', '.');
if (is_null($entity_id) && ($entities = \Drupal::entityQuery($entity_type_id)->execute())) { if (is_null($entity_id)) {
// @todo Add paging. $entities = \Drupal::entityQuery($entity_type_id)->execute();
foreach ($entities as $entity_id) {
$serialized_by_type = $manager->exportContentWithReferences($entity_type_id, $entity_id);
$manager->writeDefaultContent($serialized_by_type, $folder);
}
} }
else { else {
$entities = array($entity_id);
}
// @todo Add paging.
foreach ($entities as $entity_id) {
$serialized_by_type = $manager->exportContentWithReferences($entity_type_id, $entity_id); $serialized_by_type = $manager->exportContentWithReferences($entity_type_id, $entity_id);
$manager->writeDefaultContent($serialized_by_type, $folder); $manager->writeDefaultContent($serialized_by_type, $folder);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment