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


PHP Migration::getSourcePlugin方法代碼示例

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


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

示例1: getSource

 /**
  * Get the source plugin to test.
  *
  * @param array $configuration
  *   The source configuration.
  * @param array $migrate_config
  *   The migration configuration to be used in parent::getMigration().
  * @param int $status
  *   The default status for the new rows to be imported.
  *
  * @return \Drupal\migrate\Plugin\MigrateSourceInterface
  *   A mocked source plugin.
  */
 protected function getSource($configuration = [], $migrate_config = [], $status = MigrateIdMapInterface::STATUS_NEEDS_UPDATE)
 {
     $this->migrationConfiguration = $this->defaultMigrationConfiguration + $migrate_config;
     $this->migration = parent::getMigration();
     $this->executable = $this->getMigrateExecutable($this->migration);
     // Update the idMap for Source so the default is that the row has already
     // been imported. This allows us to use the highwater mark to decide on the
     // outcome of whether we choose to import the row.
     $id_map_array = ['original_hash' => '', 'hash' => '', 'source_row_status' => $status];
     $this->idMap->expects($this->any())->method('getRowBySource')->willReturn($id_map_array);
     $constructor_args = [$configuration, 'd6_action', [], $this->migration];
     $methods = ['getModuleHandler', 'fields', 'getIds', '__toString', 'getIterator', 'prepareRow', 'initializeIterator', 'calculateDependencies'];
     $source_plugin = $this->getMock('\\Drupal\\migrate\\Plugin\\migrate\\source\\SourcePluginBase', $methods, $constructor_args);
     $source_plugin->expects($this->any())->method('fields')->willReturn([]);
     $source_plugin->expects($this->any())->method('getIds')->willReturn([]);
     $source_plugin->expects($this->any())->method('__toString')->willReturn('');
     $source_plugin->expects($this->any())->method('prepareRow')->willReturn(empty($migrate_config['prepare_row_false']));
     $source_plugin->expects($this->any())->method('initializeIterator')->willReturn([]);
     $iterator = new \ArrayIterator([$this->row]);
     $source_plugin->expects($this->any())->method('getIterator')->willReturn($iterator);
     $module_handler = $this->getMock('\\Drupal\\Core\\Extension\\ModuleHandlerInterface');
     $source_plugin->expects($this->any())->method('getModuleHandler')->willReturn($module_handler);
     $this->migration->expects($this->any())->method('getSourcePlugin')->willReturn($source_plugin);
     return $this->migration->getSourcePlugin();
 }
開發者ID:scratch,項目名稱:gai,代碼行數:38,代碼來源:MigrateSourceTest.php

示例2: getSource

 /**
  * Returns the source.
  *
  * Makes sure source is initialized based on migration settings.
  *
  * @return \Drupal\migrate\Plugin\MigrateSourceInterface
  *   The source.
  */
 protected function getSource()
 {
     if (!isset($this->source)) {
         $this->source = $this->migration->getSourcePlugin();
     }
     return $this->source;
 }
開發者ID:HakS,項目名稱:drupal8_training,代碼行數:15,代碼來源:MigrateExecutable.php

示例3: getSource

 /**
  * Returns the source.
  *
  * Makes sure source is initialized based on migration settings.
  *
  * @return \Drupal\migrate\Plugin\MigrateSourceInterface
  *   The source.
  */
 protected function getSource()
 {
     if (!isset($this->source)) {
         $this->source = $this->migration->getSourcePlugin();
         // @TODO, find out how to remove this.
         // @see https://www.drupal.org/node/2443617
         $this->source->migrateExecutable = $this;
     }
     return $this->source;
 }
開發者ID:scratch,項目名稱:gai,代碼行數:18,代碼來源:MigrateExecutable.php


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