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


PHP Migration::getProcessPlugins方法代碼示例

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


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

示例1: processRow

 /**
  * {@inheritdoc}
  */
 public function processRow(Row $row, array $process = NULL, $value = NULL)
 {
     foreach ($this->migration->getProcessPlugins($process) as $destination => $plugins) {
         $multiple = FALSE;
         /** @var $plugin \Drupal\migrate\Plugin\MigrateProcessInterface */
         foreach ($plugins as $plugin) {
             $definition = $plugin->getPluginDefinition();
             // Many plugins expect a scalar value but the current value of the
             // pipeline might be multiple scalars (this is set by the previous
             // plugin) and in this case the current value needs to be iterated
             // and each scalar separately transformed.
             if ($multiple && !$definition['handle_multiples']) {
                 $new_value = array();
                 if (!is_array($value)) {
                     throw new MigrateException(sprintf('Pipeline failed for destination %s: %s got instead of an array,', $destination, $value));
                 }
                 $break = FALSE;
                 foreach ($value as $scalar_value) {
                     try {
                         $new_value[] = $plugin->transform($scalar_value, $this, $row, $destination);
                     } catch (MigrateSkipProcessException $e) {
                         $break = TRUE;
                     }
                 }
                 $value = $new_value;
                 if ($break) {
                     break;
                 }
             } else {
                 try {
                     $value = $plugin->transform($value, $this, $row, $destination);
                 } catch (MigrateSkipProcessException $e) {
                     break;
                 }
                 $multiple = $multiple || $plugin->multiple();
             }
         }
         // No plugins means do not set.
         if ($plugins) {
             $row->setDestinationProperty($destination, $value);
         }
         // Reset the value.
         $value = NULL;
     }
 }
開發者ID:scratch,項目名稱:gai,代碼行數:48,代碼來源:MigrateExecutable.php

示例2: testGetProcessPlugins

 /**
  * Tests Migration::getProcessPlugins()
  *
  * @covers ::getProcessPlugins()
  */
 public function testGetProcessPlugins()
 {
     $migration = new Migration([], 'migration');
     $this->assertEquals([], $migration->getProcessPlugins([]));
 }
開發者ID:davidsoloman,項目名稱:drupalconsole.com,代碼行數:10,代碼來源:MigrationTest.php


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