當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConfigImporter::doSyncStep方法代碼示例

本文整理匯總了PHP中Drupal\Core\Config\ConfigImporter::doSyncStep方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConfigImporter::doSyncStep方法的具體用法?PHP ConfigImporter::doSyncStep怎麽用?PHP ConfigImporter::doSyncStep使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Config\ConfigImporter的用法示例。


在下文中一共展示了ConfigImporter::doSyncStep方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: configImport

 private function configImport($io, StorageComparer $storage_comparer)
 {
     $config_importer = new ConfigImporter($storage_comparer, \Drupal::service('event_dispatcher'), \Drupal::service('config.manager'), \Drupal::lock(), \Drupal::service('config.typed'), \Drupal::moduleHandler(), \Drupal::service('module_installer'), \Drupal::service('theme_handler'), \Drupal::service('string_translation'));
     if ($config_importer->alreadyImporting()) {
         $io->success($this->trans('commands.config.import.messages.already-imported'));
     } else {
         try {
             if ($config_importer->validate()) {
                 $sync_steps = $config_importer->initialize();
                 foreach ($sync_steps as $step) {
                     $context = array();
                     do {
                         $config_importer->doSyncStep($step, $context);
                     } while ($context['finished'] < 1);
                 }
             }
         } catch (ConfigImporterException $e) {
             $message = 'The import failed due for the following reasons:' . "\n";
             $message .= implode("\n", $config_importer->getErrors());
             $io->error(sprintf($this->trans('commands.site.import.local.messages.error-writing'), $message));
         } catch (\Exception $e) {
             $io->error(sprintf($this->trans('commands.site.import.local.messages.error-writing'), $e->getMessage()));
         }
     }
 }
開發者ID:blauerberg,項目名稱:DrupalConsole,代碼行數:25,代碼來源:ImportSingleCommand.php

示例2: testCustomStep

 /**
  * Tests that the isConfigSyncing flag is set correctly during a custom step.
  */
 public function testCustomStep()
 {
     $this->assertFalse(\Drupal::isConfigSyncing(), 'Before an import \\Drupal::isConfigSyncing() returns FALSE');
     $context = [];
     $this->configImporter->doSyncStep([self::class, 'customStep'], $context);
     $this->assertTrue($context['is_syncing'], 'Inside a custom step \\Drupal::isConfigSyncing() returns TRUE');
     $this->assertFalse(\Drupal::isConfigSyncing(), 'After an valid custom step \\Drupal::isConfigSyncing() returns FALSE');
 }
開發者ID:aWEBoLabs,項目名稱:taxi,代碼行數:11,代碼來源:ConfigImporterTest.php


注:本文中的Drupal\Core\Config\ConfigImporter::doSyncStep方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。