You are here

public static function Migration::runFlowExport in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 2.0.x src/Controller/Migration.php \Drupal\cms_content_sync\Controller\Migration::runFlowExport()
2 calls to Migration::runFlowExport()
Migration::runActiveStep in src/Controller/Migration.php
MigrationForm::submitForm in src/Form/MigrationForm.php
Form submission handler.

File

src/Controller/Migration.php, line 208

Class

Migration
Migration Embed provides methods and a UI to migrate from Content Sync v1 to Content Sync v2.

Namespace

Drupal\cms_content_sync\Controller

Code

public static function runFlowExport($machine_names = null) {
  self::useV2(true);

  // TODO: Use batch operation.
  foreach (Flow::getAll() as $flow) {
    if ($machine_names ? in_array($flow
      ->id(), $machine_names) : !$flow
      ->v2Ready()) {
      $flow
        ->getController()
        ->updateEntityTypeVersions();
      $exporter = new SyncCoreFlowExport($flow, true);
      $batch = $exporter
        ->prepareBatch();
      $batch
        ->executeAll();
      self::setFlowV2Ready($flow);
    }
  }
  \Drupal::messenger()
    ->addMessage(t('Successfully exported your Flows to the new Sync Core v2.'));
}