当前位置: 首页>>代码示例>>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;未经允许,请勿转载。